[whatwg] number-related feedback
Shannon
shannon at arc.net.au
Thu Aug 21 22:14:38 PDT 2008
I was going to suggest the spec define unsigned integers as a value
between 1 and MAX_INT inclusive when I realised the spec doesn't define
the range of integer values at all. Is this deliberate?
Either way I would recommend making a decision on minimum and maximum
integer values an using them consistently. If not I can imagine the
rapid adoption of 64-bit systems will cause unexpected errors when the
same code is run on older 32-bit systems. There are valid arguments for
letting each system use its native integer but if this is the case then
perhaps the spec should require MIN_INT and MAX_INT be made available as
constants.
Also the spec interchanges the terms "non-negative integer", "positive
integer" and "unsigned integer". I suggest defining one of these clearly
and then using it everywhere.
This is a very minor point but is it necessary to say "valid integer".
Given that there appears to be no defined min/max range when is
something both an integer and at the same time invalid? Isn't an invalid
integer a string?
Finally I wasn't aware Javascript made a distinction between signed and
unsigned integers. Is the distinction really necessary? Can we just make
everything signed integers and consistently call the full range
"integer" and the positive range "integer greater than 0"?
Shannon
More information about the whatwg
mailing list