Array lengthening methods applied to maximally long arrays
James Graham
jgraham at opera.com
Wed May 13 02:14:39 PDT 2009
As far as I can tell, the ES5-specified behavior of
a = new Array()
a.length = Math.pow(2,32)-1
a.push(1)
is to create a non-array-index property of the array with name
4294967296 (i.e. 2^32) and value 1 before throwing a RangeError hen
trying to update the length. However this property isn't created in the
majority of implementations (at least it doesn't happen in my builds of
Spidermonkey, V8 and Squirrelfish) and since it is rather surprising
that the operation would, in some sense, succeed before throwing an
error, it seems like it might be nice to change this part of the spec to
reflect the implementations.
More information about the es-discuss
mailing list