Even simpler lambdas

Dean Landolt dean at deanlandolt.com
Tue Apr 17 17:18:00 PDT 2012


On Tue, Apr 17, 2012 at 6:05 PM, Peter van der Zee <ecma at qfox.nl> wrote:

> On Tue, Apr 17, 2012 at 10:11 PM, Brendan Eich <brendan at mozilla.org>
> wrote:
> > François REMY wrote:
> >>
> >> I kinda like it.
> >
> >
> > I don't, but what's more, Tab's point has come up already in TC39 in
> similar
> > settings. I doubt this will fly. It's hard to see 'return' in an
> expression
> > as different from 'return' at statement level. That's a readability
> problem
> > that I suspect would sink this if it were to get to TC39.
>
> I don't agree. The return-statement keyword is very much
> distinguishable from the return-lambda keyword. How often do you make
> the mistake for a function declaration vs function expression?
>
> On Tue, Apr 17, 2012 at 6:05 PM, Tab Atkins Jr. <jackalmage at gmail.com>
> wrote:
> > This doesn't seem simpler than:
> >
> > arr.map((x,y)=> '<' + x + 'class="' + this.getClassName(y) + '"/>');
> >
> > Your other variants that shorten the 'arguments' name are better, but
> > don't appear to offer much of a win.  They also prevent you from using
> > the argument list to good effect, such as by giving them descriptive
> > names or using destructuring and rest args.
>
> I can see that point. However, as François points out, we very often
> use lambdas in contexts where the arguments don't really need a name
> in simple expressions, and could be named if you need slightly more
> complex lambdas. As for spread, you'll still have access to the
> arguments array


Was it ever the plan to eventually deprecate the arguments free var?
Rest-args renders it irrelevant, at least -- it'd be a shame to add in
something else that depended on it.


> (or $ or whatever you wanna end up with). A simple
> slice will suffice.
>
> - peter
> _______________________________________________
> 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/20120417/6230406a/attachment.html>


More information about the es-discuss mailing list