Shorthand for "function" keyword

Eli Perelman eli at eliperelman.com
Fri Nov 10 23:00:24 UTC 2017


> I'm having trouble believing saving a couple of characters will have the
weight to make it happen

I think this is the crux of the issue. What is the cost vs. benefit of the
proposal, and do these benefits outweigh the tradeoffs?

The only benefit seems to be saving a few characters. The costs being an
increase in complexity in the ways you can define a function, an increase
in the complexity of parsing for functions, and the need to endure a
candidate stage process for the removal of a few characters. To me, the
costs far outweigh the benefit of just using the existing ways of declaring
functions.

TLDR; to me this is -1.

Eli Perelman

On Fri, Nov 10, 2017 at 4:51 PM T.J. Crowder <
tj.crowder at farsightsoftware.com> wrote:

> On Fri, Nov 10, 2017 at 7:25 PM, Laurentiu Taschina <
> source.spider at gmail.com> 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:
>
> ```js
> 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
> _______________________________________________
> 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/20171110/eb1544c3/attachment.html>


More information about the es-discuss mailing list