arrow function syntax simplified

Jorge jorge at jorgechamorro.com
Mon Apr 2 08:20:35 PDT 2012


On Apr 2, 2012, at 2:12 PM, Brendan Eich wrote:
> Jorge wrote:
>> 
>> No [[Scope]]? I must be missing something! Given this code:
>> 
>> bound= (function a(i) { return function b () { return i }.bind(null) })(27); 
>> bound()
>> -->  27
>> 
>> How can bound() resolve `i` without a [[Scope]] ?
> 
> By delegating to bound()'s [[TargetFunction]], which does have a [[Scope]] -- see ES5 15.3.4.5.1 and 15.3.4.5.2.

Oh, I see. Thank you!

>>> >  6. Arrow functions (AF). Features: captured `this', captured `this' even in case of `new'. 
>> 
>> And [[Extensible]] === false... I wonder why, why non-extensible ?
> 
> No, arrows are extensible -- where did you see [[Extensible]] === false?

I saw it here: <http://www.yuiblog.com/blog/2012/03/30/what-is-the-meaning-of-this>

"Function objects are mutable like other objects. This will make the securing of JavaScript more difficult because every function object can be used as a channel to facilitate unwanted collusion between widgets. ES5 provides tools to freeze functions, making them immutable, but the tools are really difficult to use for that purpose. The Sixth Edition of ECMAScript may correct all of these problems."
...
"Fat arrow functions do not have prototype properties, which makes them cheaper to make. They are immutable."
...
"You will need the old functions to make mutable functions, although I don’t recommend those either."
-- 
Jorge.


More information about the es-discuss mailing list