ES Decimal status

Brendan Eich brendan at mozilla.org
Wed Sep 24 09:26:04 PDT 2008


On Sep 24, 2008, at 9:17 AM, Brendan Eich wrote:

> On Sep 24, 2008, at 9:01 AM, Mike Cowlishaw wrote:
>> Absolutely not a problem ... many languages (and ES itself) which
>> index
>> 'arrays' by strings treat the index "1.000" as different from "1",  
>> and
>> this is not considered a problem.
>
> But they do not treat 1.000 as an index differently from 1. Explicit
> string indexes, whether literally expressed or computed, are not the
> issue here.

I should have written "explicitly string-typed indexes", or perhaps  
"intentionally string-type indexes".

So far, intentions aside, people writing JS can and arguably do count  
on any integer result of an index computation being equivalent to  
that index expressed literally as the === integer constant with no  
trailing zeroes after the decimal point.

This a === b => o[a] is o[b] invariant (ignore the tiny number  
exceptions; I agree they're undesirable spec bugs) is what folks on  
the list are concerned about breaking, for integral values.  
Fractional index values and strings consisting of numeric literals  
with and without trailing zeroes are different use-cases, not of  
concern.

/be


More information about the Es-discuss mailing list