Obviously I meant "push" rather than "pop" in the second to last paragraph
>-----Original Message----- >From: es-discuss-boun...@mozilla.org [mailto:es-discuss- >boun...@mozilla.org] On Behalf Of Allen Wirfs-Brock >Sent: Wednesday, May 13, 2009 8:19 AM >To: James Graham; es-discuss@mozilla.org; es5-disc...@mozilla.org >Subject: RE: Array lengthening methods applied to maximally long arrays > >Here's what I observed: > >Opera 9.63 - conforms to ES3/ES5 spec. >Range error on a.push(1) after creating a non-array index property named >"4294967295" and leaving length as 4294967295 >Chrome 1.0.154.65 conforms to ES3/ES5 spec. >Range error on a.push(1) after creating a non-array index property named >"4294967295" and leaving length as 4294967295 > >Firefox 3.0.8 - does not conform >No range error on a.push(1) returns 0, creates a non-array index >property named "4294967295" and sets length to 0 >Safari 3.1.2 - does not conform >No range error on a.push(1) returns 0, creates a non-array index >property named "4294967295" and sets length to 0 > >IE8 - does not conform >No range error on a.push(1) returns 0, creates a non-array index >property named "-1" and sets length to 0 > >It's possible that developmental builds of the above produce different >results. As there is significant variance I don't see a strong reason >to change the spec. to reflect the FF behavior. > >It might be arguably better if pop threw the range error before creating >any new properties. This would be easy to specify (and detect in >implementations) for pop but for consistency that approach should >probably also be applied to all the Array.prototype functions and it >might be considerably harder to specify/implement such pre-flight >checking for some of the more complex algorithms particularly in the >presences of accessor properties with side-effects. > >In an earlier draft I tried to say that final state of the array was >unspecified if any exception was thrown but there was considerable >negative reaction to that proposal. > >Allen > > > >>-----Original Message----- >>From: es-discuss-boun...@mozilla.org [mailto:es-discuss- >>boun...@mozilla.org] On Behalf Of James Graham >>Sent: Wednesday, May 13, 2009 2:15 AM >>To: es-discuss@mozilla.org >>Subject: Array lengthening methods applied to maximally long arrays >> >>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. >>_______________________________________________ >>es-discuss mailing list >>es-discuss@mozilla.org >>https://mail.mozilla.org/listinfo/es-discuss > >_______________________________________________ >es-discuss mailing list >es-discuss@mozilla.org >https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss