BTF Measurements

Brendan Eich brendan at mozilla.org
Wed Mar 14 12:24:39 PDT 2012


Kevin Smith wrote:
> This suggests that an additional short function syntax that does *not* 
> bind 'this' may not be necessary.
This is helpful.

Still I am in favor of (params) -> {stmts} as shorthand for unbound-this 
function, assuming (params) => assign-expr makes it. There are enough 
use-cases, even at ~10%, to make the case. We don't add affordances only 
for the 80% or even 90% cohort. Expert cohorts and the tyranny of JS's 
statement vs. expression grammar inherited from C, combined with plain 
old function being overlong, suggest at least considering -> functions.

Adding do expressions to the mix, TCP conformant in all ways, does 
undermine my minority-use-case argument, though. (params) => do {stmts} 
has a bit too much in the middle (=>do) and the TCP-ness means 
plain-old-function use-cases need careful rewriting and may suffer high 
binding overhead, but if those are rare enough...

The method definition shorthand for plain-old-functions as property 
initialisers undermines the case for -> too.

I still intend to update the arrow function syntax strawman to include 
thin arrow but it will be something that could be cut without hurting => 
(and I'll link to the do-expressions strawman).

/be


More information about the es-discuss mailing list