Maybe ban holes, then...

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Feb 2 13:21:56 PST 2012


On Feb 2, 2012, at 1:10 PM, Brendan Eich wrote:

> Ok, you guys have holes in your head. No offense!
> 
> Holey patterns are useful, as occasionally are holey arrays. If you disagree on the latter, please acknowledge we are stuck with holey arrays for a long time, and array destructuring patterns are supplemental syntax based on a cover-grammar parse as array literals. This says holes win. If we have to argue about this, I think we'll do a disservice to bigger-impact issues that need resolution.

False alarm... You're right, they've always been in ES  array literals and they are in the draft spec. for Array destructuring patterns.   

If there were being proposed as a new syntactic feature (as I believe that somebody did a while ago for elisions in argument lists) that would be a different matter and I'd have some objections.

Allen




> 
> /be
>> Herby Vojčík <mailto:herby at mailbox.sk>
>> February 2, 2012 12:21 PM
>> 
>> 
>> A bit off-topic... I don't like paretheses. Not only because I have to put them in both ends, but also because of uncomfortable feeling of "thing closed in parentheses".
>> 
>> Maybe alternative convention to deal with expressions beginning with { could be used as well:
>> 
>>  0, {5:x} = someArray;
>>  0, {0:a, 2:y} = someArray;
>> 
>> Herby
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>> 
>> Herby Vojčík <mailto:herby at mailbox.sk>
>> February 2, 2012 11:49 AM
>> 
>> 
>> 
>> 
>> If
>> 
>>  {"5":x} = someArray;
>> 
>> and
>> 
>>  {"0":a, "2":y} = someArray;
>> 
>> would be possible, there is probably little need for holes. In case of
>> 
>>  [a,b,c,d,,f] = someArray;
>> 
>> one could always use (some conventional) anon-var, like _ (from Prolog):
>> 
>>  [a,b,c,d,_,f] = someArray;
>> 
>> Herby
>> 
> 



More information about the es-discuss mailing list