arrow function syntax simplified

Brendan Eich brendan at mozilla.org
Fri Mar 30 17:54:31 PDT 2012


We do not want to delegate to a target function that can [[Construct]], 
because there is no such target function -- we're not trying to sugar 
.bind on a full function. That is too expensive and general (no 
pre-args, no full function under the hood).

Lexical-only |this| binding means no [[Construct]] and no .prototype for 
arrow functions. I'm ok with this.

The concern about JQuery or other code wanting to dynamically bind 
|this| is good but not fatal. Use a long-hand function. I've heard 
people complain about JQuery's "pronoun trouble" enough to take it with 
a grain of salt. I know, JQuery, but still: use a long function.

/be

Axel Rauschmayer wrote:
> My bad. It is, minus [[Construct]] and *.prototype. I misremembered 
> how bind() works.
>
> On Mar 30, 2012, at 0:01 , Axel Rauschmayer wrote:
>
>> Interesting. So x => x * x is not just syntactic sugar for
>>
>>      function (x) { return x * x }.bind(this)
>>


More information about the es-discuss mailing list