On 2020-01-13 12:56, Brad Gilbert wrote:
Ok looking into it, zero is inside of the set of cardinal numbers.
It is still wrong to call a uint a cardinal number.
It's just wrong for a different reason.
Looking through various definitions, a cardinal number is a number which
represents a count of sets.
"count of sets" is going to far with the definition. "Counting
number" is all a cardinal /unsigned integer is.
So a uint could be used to represent a cardinal number, but it could
just as easily be a number that represents something other than a count.
If it is being used to index into a list it would be an ordinal number.
(And so definitely not a cardinal number.)
Calling them cardinal numbers would imply something about them that may
or may not be true.
The same would apply to calling it an unsigned integer. You
are drilling down too far.
If it is being used to store a bitmask, then it would be wrong to call
it a cardinal, ordinal, or even a natural number.
How so? It is a collection of bits that counting numbers.
And you'd want to use a cardinal in a bit mask as the high
bit is not hijacked for the sign.
It may also be wrong to call it an integer, but at least that is what
CPU designers call it.
Hi Brad,
When I use the term "cardinal" I am using the generic
arithmetic and programming term. We call it a "uint"
is Raku. Each computer language has it own set of
requirements and limitations for such. I mean nothing
more or nothing less.
My only beef is with the error message. I would like
the message changed to more accuracy reflect the
issue:
This type cannot unbox to a native integer
to
This type cannot unbox to subset UInt
or really pushing it:
This type cannot unbox to native unsigned integer
The error is that athe variable is not a "native
integer", it is a native "unsigned integer". This is
clearly stated at:
https://docs.raku.org/language/nativetypes
int Equivalent to Int (with limited range)
uint Equivalent to Int (with limited range) with
the unsigned trait
-T