[whatwg] number-related feedback
ian at hixie.ch
Mon Dec 29 02:37:17 PST 2008
On Fri, 22 Aug 2008, Shannon wrote:
> 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?
Yes. The range is likely to differ based on the platform used -- today's
32 bit systems will likely have different ranges than next decade's 128
> 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
ECMAScript does define a range, and the limits of that range are exposed
to scripts. Are there cases where there are non-script limits that would
benefit from being exposed? Use cases would be helpful here.
> 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.
"non-negative integer" is used to mean zero-or-more. I got rid of all
cases of "positive integers" I could find. I changed the heading of the
section on non-negative integers to say "non-negative" instead of
"unsigned" but now the sections are inconsistently named, which may annoy
me enough that I'll change it back at some point.
> 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?
A valid integer is a string also. I don't understand what you mean.
> 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"?
WebIDL defines behavior for unsigned integers that is different from
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg