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

Herby Vojčík herby at
Thu Feb 2 11:49:13 PST 2012

Allen Wirfs-Brock wrote:
> That said, I'd hate to see things like:
> [,,,,,x] = someArray;
> and even
> [a,,y] = someArray;
> can be easily missed.
> It isn't clear to me that we are doing ES programmers (especially those
> with poor eyesight) a favor by allowing such expressions. What is the
> evidence with JS1.7 up. How much usage do we see of such holes?


   {"5":x} = someArray;


   {"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;


More information about the es-discuss mailing list