arrow function syntax simplified

Kevin Smith khs4473 at
Tue Mar 27 19:14:32 PDT 2012

> No, the strawman says => *always* lexically binds |this|. How was it
> unclear? I will fix it.

Yes - I understood that.  My point (and *I* was probably being unclear -
it's late here on the east coast) was that if you want lexically bound this
for multistatement closures, you can choose

    (x) => do { ;;; }

    // or

    (this = this, x) -> { ;;; }

Both of which are a little heavy.  Not bad, though.  On the other hand,
this might strike just the right balance:

    (x) -> {
      this; // lexically bound - yay!

In other words, all arrow functions would have lexically bound this, and
the fatness of the arrow would distinguish between blocks and expressions.
 This is a departure from CoffeeScript, I realize.

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

More information about the es-discuss mailing list