Arrow function syntax cover syntax

Russell Leggett 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. :)


>
> Dave
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120409/c91fa35b/attachment.html>


More information about the es-discuss mailing list