Re: Array length property wrap-around

2008-12-12 Thread Jeff Walden
I've been looking at the implementation of arrays in SpiderMonkey lately to fix some edge-case bugs in them, and I think there might be simplifications we could make to our code if what's suggested here were codified in ES3.1 or similar. In particular it would be good not to be forced to repre

Re: Array length property wrap-around

2008-11-20 Thread Kent Hansen
Kent Hansen wrote: David-Sarah Hopwood wrote: Kent Hansen wrote: Hi, What's supposed to happen when one of the built-in methods (e.g. Array.prototype.push) tries to assign a value greater than 4294967295 to the length property? js> a = new Array(4294967295); a.push("foo") 0 i.e. the lengt

Re: Array length property wrap-around

2008-11-20 Thread Kent Hansen
David-Sarah Hopwood wrote: Kent Hansen wrote: Hi, What's supposed to happen when one of the built-in methods (e.g. Array.prototype.push) tries to assign a value greater than 4294967295 to the length property? js> a = new Array(4294967295); a.push("foo") 0 i.e. the length becomes 0. T

Re: Array length property wrap-around

2008-11-20 Thread David-Sarah Hopwood
David-Sarah Hopwood wrote: > Kent Hansen wrote: >> Hi, >> What's supposed to happen when one of the built-in methods (e.g. >> Array.prototype.push) tries to assign a value greater than 4294967295 to >> the length property? >> >> js> a = new Array(4294967295); a.push("foo") >> 0 >> >> i.e. the lengt

Re: Array length property wrap-around [nitpicking]

2008-11-20 Thread David-Sarah Hopwood
I wrote: > ToArrayLength(V) > > 1. Call ToNumber(V). > 2. If Result(1) is not a nonnegative integer less than or equal to > ArrayLengthLimit, then throw a RangeError. "... then throw a RangeError exception." [...] > The resulting 'concat', 'push', and 'unshift' methods can throw a > RangeE

Re: Array length property wrap-around

2008-11-19 Thread David-Sarah Hopwood
Kent Hansen wrote: > Hi, > What's supposed to happen when one of the built-in methods (e.g. > Array.prototype.push) tries to assign a value greater than 4294967295 to > the length property? > > js> a = new Array(4294967295); a.push("foo") > 0 > > i.e. the length becomes 0. This is a specificatio