Array#splice sparse array spec question.

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Apr 9 09:02:51 PDT 2012


 now https://bugs.ecmascript.org/show_bug.cgi?id=332 


On Apr 9, 2012, at 8:51 AM, Allen Wirfs-Brock wrote:

> This is a spec.  bug.  Immediately before line10 of the algorithm there should be a line that says:
> 
>         Call the [[Put]] internal method of A with arguments "length", actualDeleteCount, and true. 
> 
> The ES3 spec. has the equivalent of the above line.  It was apparently inadvertently  dropped in the ES5 spec. 
> 
> Chrome's behavior (and also Firefox, I haven't checked others) matches the intended ES3 behavior.
> 
> I'll file a bug against the the ES5 spec.
> 
> Allen
> 
> 
> 
> 
> 
> 
> 
> Chrome is correct 
> On Apr 9, 2012, at 8:19 AM, John-David Dalton wrote:
> 
>> Can someone confirm/reject that by spec (http://es5.github.com/#x15.4.4.12):
>> 
>> // sparse array ;D
>> var a=[0];
>> a[2]=2;
>> 
>> // the resulting arrays length should be 1 and not 2
>> console.log(a.splice(0, 2).length);
>> 
>> I'm seeing `2` in latest Chrome/FF.
>> 
>> Thanks,
>> -JDD
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120409/8c4dcef4/attachment.html>


More information about the es-discuss mailing list