>
> 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:

https://github.com/joyent/node/blob/master/lib/http.js#L1633-1652


kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to