arrow function syntax simplified

Kevin Smith khs4473 at
Tue Mar 27 21:09:47 PDT 2012

> I hate the CoffeeScript deviation, though. It's just confusing for anyone
> who ever learned that fat-arrow binds |this| and thin-arrow doesn't.

True.  On the other hand, "all arrows bind |this|" is also quite simple and
easy to remember.

If the use-case for block bodies with bound |this| is uncommon enough, we
> could just say "use a good ol' function expression long-hand." Would that
> be so bad, compared to the alternative you're suggesting?

I think that use case is quite common, if we include function expressions
that don't care about |this|, bound or not.  For Node's js source (as of a
few weeks ago), there are 456 function expressions which are
algorithmically convertible to bound |this| forms (because they either
currently explicitly bind using self = this or because they don't care
about |this|).  Of those, about 60% are multi-statement.

As an example, the following function expression is multi-statement and
since it doesn't care about |this|, it can be rewritten using a (shorter)
bound |this| form:

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

More information about the es-discuss mailing list