
JavaScript proposal: destructuring assignment - fogus
http://wiki.ecmascript.org/doku.php?id=proposals:destructuring_assignment
======
samth
That link is to a really old ES4 discussion. The proposal for ES6 is at
<http://wiki.ecmascript.org/doku.php?id=harmony:destructuring> and has now
been incorporated in the draft ES6 spec.

------
wingo
A form of this will probably be in ES6:

[http://people.mozilla.org/~jorendorff/es6-draft.html#sec-11....](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-11.13.1)

------
yoklov
CoffeeScript implements this syntax, and, of course, it's extremely awesome.

<http://coffeescript.org/#destructuring>

------
fmstephe
I think this is a great proposal. I would be very happy to see destructuring
assignment in JS. In every other language I've used that supports this
(Erlang, Clojure) it is a big win.

------
VMG
This would be extremely handy. At the moment I'm sometimes even writing

    
    
       (function (a, b, c) {/**/}).apply(null, packed);
    

to emulate destructuring.

------
Roboprog
Cool, if it gets widespread implementation.

Had to read a ways down to see an example to confirm, in simple terms, that
this would mean you could make function calls such as:

( a, b, c) = f();

like you would in Perl / Python / Ruby. (not so good at decoding BNF while I'm
sipping my first cup of coffee in the morning...)

------
Zecc
This is something that's been in Firefox's JS way back since FF 2.0.

<https://developer.mozilla.org/en/New_in_JavaScript_1.7>

------
antinitro
Seems like half of the comments are from 6 years ago, am I missing something?

