An array destructing specification choice

Brendan Eich brendan at mozilla.com
Sat Nov 5 17:55:09 PDT 2011


On Nov 5, 2011, at 3:50 PM, Erik Arvidsson wrote:

> On Sat, Nov 5, 2011 at 14:41, Brendan Eich <brendan at mozilla.com> wrote:
>> 1. Should an array pattern always query 'length'?
>> 
>> 2. If the answer to (1) is "no", then should ... in an array pattern query 'length'?
>> 
>> On reflection and at this point in the thread, with your reply in mind, my prefs in order: [no, yes], [no, no]. In no case do I favor [yes]. I'm refutably matching [no, _] :-P.
> 
> If we don't do start index to length - 1 then we have to determine the
> enumeration method. Is it?
> 
> A) own properties
> B) all properties

For {x, y, ...r} = o the answer would be (B) -- if o = {w:0} <| {x:1, y:2, z:3}, then r would be {w:0, z:3}.


> C) object[iterator]() and ignore the items before start index

Iteration is for the "value domain", so I wouldn't mix it in here in key-land.

/be


> 
> Maybe C is preposterous but just putting it out there for consistency.
> 
> -- 
> erik



More information about the es-discuss mailing list