Even simpler lambdas
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>
> > 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
> > settings. I doubt this will fly. It's hard to see 'return' in an
> > as different from 'return' at statement level. That's a readability
> > 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>
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss