Generalizable Function Modifier Syntax

Kevin Smith zenparsing at
Mon Mar 17 20:25:53 PDT 2014

Thanks, Brendan!

> This lines up with what Luke Hoban presented at the last TC39 meeting. So
> far, so good (but not a done deal by any means, of course). The main bone
> of contention is the use of ! in promises future-proposed syntax.

"!" won't work, in my opinion.  Besides being an eyesore, it is unfriendly
to chaining because of the newline restrictions required by ASI.  E.g. this
won't work as expected:


>  The hard part is arrow functions.  One possibility would be to use
>> another cover grammar and place the modifier to the left of the arrow
>> function:
>>     modifier [NoNewLine] Identifier =>
>>     modifier [NoNewLine] ArgumentList =>
> We could do this.
Don't need the newline restriction in the second rule:

    modifier [NoNewLine] Identifier =>
    modifier ArgumentList =>

I was able to generically implement this syntax without too much trouble
[1].  Allowing default initializers in the arrow function head makes me
nervous though, given Javascript's context-sensitive tokenization.  Do you
think that was a mistake?

In any case, I think this is the way to go for generic function modifiers!

I'll post some other feedback regarding async functions in the near future.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list