Herhut, Stephan A wrote:
Regarding your comment on length: I don't get that. If I do

let [x,y] = e;

where is length getting involved (other than in the destructuring
algorithm)?
It should not be involved in that case. But consider a spread pattern:

  let [x, y, ...z] = e;

in this case, z should destructure an array containing all the elements (if any) in e from index 2 up to but not including e.length. So a 'length' get is needed in this case.

We had an argument last year, IIRC, about whether all array patterns should therefore get 'length' once, before any other gets from e's value, just to be "consistent".

I recall prevailing in my "no" answer :-P. We want pay-as-you-go, and ...z is a special form in the pattern that connotes 'length'-get. Without a spread pattern, no 'length' get.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to