On Mon, Feb 17, 2014 at 7:08 AM, Claude Pache <claude.pa...@gmail.com> wrote:
> Just a last note. Beyond the philosophical aspect whether arraylikes of 
> negative length make any sense at all, there is a strong technical issue you 
> have probably overlooked: For array methods in general, and for the optional 
> argument of `Array.prototype.copyWithin` in particular (see step 14 of the 
> algorithm), a negative index is not understood as an absolute position, but 
> rather as a position relative to the end of the array. For instance, for an 
> array (or arraylike) of length `n`, if `-3` is passed, it indicates position 
> `n-3`. In your case, it is certainly not the semantics you want. (In fact, 
> everything will happily coerce to `0` at the end of the journey, but it's 
> just happenstance.)

I have not overlooked it.  The fact that negative `end` is significant
is exactly the reason why using `ToLength` on it seems wrong.  Even
thought `end` defaults to `this.length`, it should still be normalized
with `ToInteger` since negative values are semantically valid.

But as you point out, I don't think there's any actual behavior
change, since everything washes out to `0` at the end.  It's just a
matter of writing a clearer more consistent spec.
  --scott
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to