Array.prototype.concat result length (ES5.1)

Jeff Walden jwalden+es at MIT.EDU
Mon Jul 18 10:51:46 PDT 2011


On 07/14/2011 10:04 AM, Allen Wirfs-Brock wrote:
> It is probably a bug, because array index based operations generally warp around to 0 at 2^32.

Freudian slip?  :-D

Easiest fix is to just add the length-set to concat.  For a quick ES5 erratum that seems best to me.

Removing all the RangeError stuff, and making array indexes just non-negative integers,  would be nice for ES6 or similar.  I suspect changing that won't break anyone worth caring about, although I do know some people have taken the time to care about this in the past (mostly in a spec-nut way :-) ):

http://hexmen.com/blog/2006/12/push-and-pop/

Without having thought too hard about exactly what would be involved, I suspect the amount of stuff you'd need to adjust, and the complexity of checking for sane behavior in all cases (including some of the 2**52 upper-bounding edge cases, depending on what new semantics you might want for "array indexes" or whatever), would make it unwise to try for ES5 errata.  But I could well be wrong about this, so I wouldn't necessarily write off that possibility.

Jeff


More information about the es-discuss mailing list