arrow function syntax simplified

Herby Vojčík herby at mailbox.sk
Wed Mar 28 04:54:28 PDT 2012



Kevin Smith wrote:
>     But aren't non-BTFs rare based on your (revised and original)
>     measurements?
>
>
> When you take out the object literal methods, that's right.
>
> The precise way to say it would be that ~90% of function expressions in
> the code I analyzed were either object literal methods or did not depend
> on dynamic |this|.

Data are data, if numbers show that it is probably true, but it seems 
strange to me, I always thought a big use case for dynamic this are the 
DOM events... didn't they use this pervasively (it was my impression 
$(this) is all over...).

> That's exactly the reason I'm suggesting lexically bound |this| for "->"
> functions, because outside of "methods" (which already have shorter
> syntax, either via object literal extensions or classes), there doesn't
> appear to be a great need for function expressions with dynamic |this|.
>
> kevin

Herby


More information about the es-discuss mailing list