arrow function syntax simplified

Kevin Smith khs4473 at gmail.com
Wed Mar 28 12:11:37 PDT 2012


>
> *Just a short hand:*
>   let thin = ( a ) -> { return x; };
>
>   The general response to this is that it makes complete sense: "just
> syntax" and "just shorthand" are common "i get it now"    phrases. Also,
> this is highly desirable ie. they want it now.
>

Despite users wanting this, the numbers seem to show that between object
literal method shorthands and a hypothetical function form which binds
|this|, a simple short-hand would get little use, and arguably not enough
to warrant new syntax.

Rick, I've added the numbers for the original (unarrowed) Popcorn.js to the
spreadsheet:

https://docs.google.com/spreadsheet/ccc?key=0Aro5yQ2fa01xdEJySWxhZ1VoZ0VaWTdldXp4NUtJd3c

Note that out of 96 function expressions, only 6 use dynamic |this| and
aren't part of an object literal.  This means that *at most* 6 of those 96
functions would need a simple shorthand for classic functions, if a bound
|this| shorthand were provided.

IMO, we can provide the greatest benefit by providing a short-hand which
also bind |this|, without any other TCP-ness.

kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120328/e6dcfc45/attachment.html>


More information about the es-discuss mailing list