http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax

"This works because Expression is a cover grammar for
FormalParameterList, with Identifier primary expressions covering
formal parameter names, array and object literals for destructuring,
assignment for parameter default values, and spread for rest
parameters."

This does not work for rest parameter since ... is only allowed inside
array literals.

var tail = (x, ...xs) => xs;

This can of course be solved in numerous ways but it is not true that
the Expression is a cover grammar for FormalParameterList.

Another option is to allow ...expression in an expression which would
have the same semantics as a comma expression where the expression has
been spread:

...expression

desugars to

var $tmp = expression;
($tmp[0], $tmp[1], ..., $tmp[$tmp.length - 1])

but that is kind of useless.

-- 
erik
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to