On 2020-01-09 10:10 a.m., ToddAndMargo via perl6-users wrote:
A bug to report:
$ p6 'my uint32 $c; $c = "ABC";'
This type cannot unbox to a native integer: P6opaque, Str
in block <unit> at -e line 1
"uint32" is not an "integer". It is a cardinal. If
they really want to use the word "integer" for cardinal,
they should change the wording to "unsigned integer".
Picky, picky, picky
ToddAndMargo, you are wrong on this.
A uint32 is NOT specifically a cardinal.
At best you can say it can be characterized by a cardinal or be isomorphic to
one.
A uint32 is just as much an ordinal as a cardinal, so insisting on calling it a
cardinal means the type can't be used as an ordinal, or a variety of other things.
Calling this an unsigned integer (u int) is much more accurate as it doesn't
presume a particular semantics such as that we are storing a count rather than a
position for example, it says what we actually know, and no more.
You are also wrong on saying that the values one can store in a uint32 are not
integers; they definitely ARE integers. Every cardinal is an integer.
If you want to be precise, calling a uint32 an "unsigned integer" or "cardinal"
is inaccurate in the same way that calling it an "integer" is. In either case,
the variable can only hold a proper subset of either type, not all of them. If
you're calling integer wrong then one will have to call the type something like
"integers in the range 0..^2**32".
-- Darren Duncan