Arrow function syntax cover syntax
russell.leggett at gmail.com
Mon Apr 9 14:14:41 PDT 2012
On Mon, Apr 9, 2012 at 5:05 PM, David Herman <dherman at mozilla.com> wrote:
> On Apr 7, 2012, at 1:40 PM, Erik Arvidsson wrote:
> > 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:
> Or allow it in the grammar and then disallow it in the post-processing.
> IOW, a cover grammar doesn't have to force us to introduce new syntactic
> forms, they just force us to put them in the *grammar*. The
> post-processing, which essentially defines the two sub-grammars for the two
> separate contexts, can remove the syntactic forms we don't want to provide
> semantics for.
Hmm...a deviously simple solution, and yet - it feels so wrong.
Grammatically legal and yet illegal. I sense complaints by implementors. :)
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss