Object.is()

Brendan Eich brendan at mozilla.com
Tue Jan 7 08:05:37 PST 2014


Andreas Rossberg wrote:
>>> Lacking true integers, that would break JavaScript's poor man's
>>> >>  emulation of arrays.
>> >
>> >  C'mon, that's not the reason. Hardly anyone generates-0  as an index and
>> >  expects it to index a[0] for some array a. Things to complain about!:-P
>
> It's not all that difficult to accidentally create a-0  when you do
> pure "integer" arithmetic with floats. I'm pretty sure it would be a
> major pitfall. Wasn't that the reason why we changed Map?

Maybe, and I'm not thrilled about that change, but Map is new, and 
different from Array or array-likes anyway (value to value mapping).

My point was Array indexing is the least of our concerns. Changing 
(-0).toString() will probably break tons of code, including numeric form 
code, even if only showing "-0" to users who want "0".

/be


More information about the es-discuss mailing list