Shorthand for "function" keyword

T.J. Crowder tj.crowder at
Fri Nov 10 22:50:43 UTC 2017

On Fri, Nov 10, 2017 at 7:25 PM, Laurentiu Taschina <source.spider at
> wrote...

So the TL;DR of all that is: You think `func` (or whatever) can be an
identifier or keyword based on context.

Well, quite true, it's certainly been done before (`async` for instance).
All I'll say is: Good luck with that, for this purpose. :-)

I'll flag up an ASI gotcha you'll need to avoid: When defining `func`
function definitions, you'll need "[no LineTerminator here]" after the
closing `)` of the parameter list. Why? Because otherwise this is a
function call followed by a standalone block thanks to ASI:

let a = func()
{ console.log("blah"); };

(Which is why AsyncFunctionDefinition has "[no LineTerminator here]" after
`async`.) But again: It's been done before, so...

I'm having trouble believing saving a couple of characters will have the
weight to make it happen, and personally wouldn't favor it, but frankly
that doesn't mean anything.

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

More information about the es-discuss mailing list