Making "super" work outside a literal?

Axel Rauschmayer axel at rauschma.de
Thu Jun 23 06:56:27 PDT 2011


>> - Making "current function" available to a function does not incur costs? This is *not* an extra parameter, then?
> 
> the current function is made available via the function name in a function declaration:
>  var q= -1;
>  Object.defineMethod(obj"foo",function bar(a,b,c) {return q*bar.length /* returns -3 */});
> 
> bar is a lexically scoped binding just like q.  No per call perimeters are involved.  The cost to access bar is approximately the same as the cost of accessing q (exact costs subject to details of how lexically scoped access is implemented)


Isn’t "bar" a named function expression and won't this binding be local to the expression (unlike q)? But I don’t think that changes the cost.

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com





More information about the es-discuss mailing list