On 2020-01-13 18:46, ToddAndMargo via perl6-users wrote:
On 2020-01-13 17:13, ToddAndMargo via perl6-users wrote:
And, no one is telling me percisely what the difference
between UInt and uint is other than one is a subset of
Int and the other is a native type. They act exactly
the same.
Hi All,
Off line, Paul told me what the difference is
between a UInt and a uint.
uint is constrained:
p6 'my uint $c = 0x0; $c = $c +| 0x1FFFFFFFFFFFFFFFF;'
Cannot unbox 65 bit wide bigint into native integer
in block <unit> at -e line 1
UInt uses magic Larry Wall powder to remove the constraints
from the variable. (Same powder he uses to create nils.)
p6 'my UInt $c = 0x0; $c = $c +|
0x1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; say $c'
862718293348820473429344482784628181556388621521298319395315527974911
Other than the constrains, they act exactly the same.
Oh, and they are both (generic programming term) unsigned integers
(cardinals)
:-)
-T
And good luck, all you who told me to read the
documentation, trying to find the constraints
explanation in the documentation:
https://docs.raku.org/type/UInt
Have fun!
But it does say "The UInt is defined as a subset of Int:"
and Int is definitely constrained.
-T