Embedded spreads is already in the ES6 draft for  both array literals
and argument lists.  I'm not at all sure that embedded rests in
destructurings are such a good idea. Just to start with, what does this mean:

  [a,b,...r,c,d = [1,2,3]

..
This sort of destructuring is not real pattern matching. ..

I think this is the important point. Many of us who like "destructuring"
are still being mislead by the name, and by our experience with proper
pattern matching constructs.

- please rename the current state to "selection shorthand"
- no matter the name, the differences between construction
   and deconstruction cannot be good

Btw, I've known at least one language where one could write

[...,['key',value],...] = some_dictionary_array

to get key-value lookups. Again, this depends crucially on proper
pattern-matching semantics (this used match failure and fallback
within a single pattern), even though it is "just" a lhs variant of
what is permitted as on the rhs.

By specifying only a simplified form of selection shorthand, while
occupying the syntactic grounds belonging to pattern matching,
we are moving on shaky ground.

Claus
http://clausreinke.github.com/
http://clausreinke.github.com/js-tools/



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to