On 2020-01-12 09:18, Marcel Timmerman
wrote:
Hi Marcel,On 1/9/20 7:10 PM, ToddAndMargo via perl6-users wrote:
'my uint32 $c; $c = "ABC";'The error shows that you cannot assign a string to an int (This type cannot unbox to a native integer: P6opaque, Str)
You can do the following to get it right;
'p6 -e 'my uint32 $c; $c = 0xABC;''
That you for the tip! I have been using Hex numbers
a lot lately.
Here is a workaround to assign the value of a cardinal ($c)
to an integer ($x):
p6 'my uint32 $c = 0xFFAA; my int32 $x = $c +| 0x0000; say $c.base(16);'
FFAA
Back on subject.
The intent of my posting was not to correct a
mistake in my code, but to demonstrate a mistake
in the description of the returned error.
Cardinals or unsigned integers, whatever you want to
call them, are not the same thing. The error description
called a cardinal and integer.
Here is one reason why you do these to to be
distinct from each other. In Win API calls to the
registry, REG_DWORDs are all cardinals, not
integers:
And having the error properly describe the variables
involved helps you troubleshoot your booboo's.
-T