Maybe ban holes, then... (was: Re: lexical for-in/for-of loose end)

Brendan Eich brendan at mozilla.org
Thu Feb 2 12:19:30 PST 2012


This is all unwanted "innovation". We have holes in arrays, and in 
SpiderMonkey and Rhino we've had holes in destructuring array patterns 
for years. No one got confused or went blind. We should stop nanny-ing 
about holes.

Some of you don't like holes, but they're not going away in arrays. They 
are useful in array patterns to avoid _ or junk bindings. That's enough 
to keep them, rather than straining to invent more cumbersome ad-hoc 
replacements.

/be

> 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
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list