Named Arrow Functions

Leonardo Wolter leocwolter at gmail.com
Wed Aug 12 00:30:32 UTC 2015


What about a clojure like recur hidden variable binded to the bottom-level
function?

 x.map(factorial(x) => do {
        if (x <= 1) {
            1;
        } else {
            x * recur(x - 1)
        }
    });

2015-08-11 21:26 GMT-03:00 Daniel Ehrenberg <dehrenberg at chromium.org>:

> In addition to being hard to parse in general, I don't think this
> would play very well with the async/await proposal
> https://tc39.github.io/ecmascript-asyncawait/ , which wants to have
> arrow functions like
>
> async (x) => ...
>
> Because we can't count on async as a keyword, your proposal would
> create an ambiguity.
>
> On Tue, Aug 11, 2015 at 1:49 PM, Jacob Parker <jacobparker1992 at gmail.com>
> wrote:
> > I did look, but couldn’t find anything on named arrow functions were not
> included. I do sometimes find cases where I want recursion inside a class
> function definition, and still need access to `this`. Was it just seen as
> syntax bloat, or were there any complications to implementing it?
> >
> > Obviously a contrived example, but something like this (using do syntax
> too)
> >
> >     x.map(factorial(x) => do {
> >         if (x <= 1) {
> >             1;
> >         } else {
> >             x * factorial(x - 1)
> >         }
> >     });
> >
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> 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/20150811/c12df7d6/attachment.html>


More information about the es-discuss mailing list