arrow function syntax simplified

Jorge jorge at jorgechamorro.com
Mon Apr 2 02:07:32 PDT 2012


On Apr 2, 2012, at 6:48 AM, Dmitry Soshnikov wrote:
> 
> 
> P.S.:
> 
> Offtopic footnote. 6 types:
> 
> 1. Function Declaration (FD). Features: "hoisting", always named.
> 
> 2. Function Expression (FE). Features: no "hoisting", available for immediately invoked functions (IIF).
> 
> 3. Named Function Expressions (NFE). Features: no "hoisting", the same as FE actually, but because of many old (?) bugs/features, especially in IE, I put them in the separate type. Since ES5 strict they are just FE if implemented correctly.
> 
> 4. Functions created via Function constructor (FF). Features: only global in the scope chain.

And always anonymous.

> 5. Bound functions (BF). Features: captures `this', but "dynamic" `this' in case of `new', no `prototype', no [[Scope]], no [[Construct]], but delegation to the target's, etc.

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]] ?

> 6. Arrow functions (AF). Features: captured `this', captured `this' even in case of `new'.

And [[Extensible]] === false... I wonder why, why non-extensible ?
-- 
Jorge.


More information about the es-discuss mailing list