arrow function syntax simplified

Kevin Smith khs4473 at
Tue Mar 27 18:54:00 PDT 2012

I like the => syntax, but I'm not convinced regarding single arrow

Some observations:

1) A shorter function syntax for classic functions doesn't seem to carry
much payoff.

2) Generally, users will want closures to have lexically-bound this.  The
strawman makes this possible via either do expressions ("=> do") or this
initializers ("(this=this, ...) -> {}"), both of which are somewhat
"clunky".  This would seem to make a large portion (perhaps even a slight
majority) of candidates for this syntax pay a "clunk" tax.

This would seem to indicate that -> functions should have lexically-bound

Also, in my analysis, I discovered that the most common number of formal
parameters for arrow function candidates is one.  I think that readability
can be improved if we can eliminate parenthesis for this common case, as in
C#. => x * x);
    // vs. => x * x);

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

More information about the es-discuss mailing list