Parameter lists as arguments destructuring sugar

Sean Eagan seaneagan1 at
Sat Apr 9 22:08:52 PDT 2011

Hi Bob,

This stuff should all be backward compatible.  You wouldn't get "1 | 2
| 3" unless you did something
like "show.apply(null, arg)" or "show(...arg)".

I considered object structuring/destructuring of arguments, but
additional syntax would be needed on parameter lists and function
invocations since the shortcut form of object structuring /
destructuring i.e. "{x, y}", would translate to "f(x, y)" and
"function (x, y){}" which are indistinguishable from traditional
forms.  Also, if object destructuring of function arguments were
supported (they would be with this proposal, the destructuring page
has an example of it, but it's not fully specified), then you could
just do this...

function ({a, b}){}
function ({a: b, c: d}){}

Sean Eagan

More information about the es-discuss mailing list