On Jun 23, 2011, at 2:56 PM, Axel Rauschmayer wrote: >>> - 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. >
Yes, that was the reason for my final comment about the exact cost. Depending upon the implementation details there may be minor difference in the cost of accessing "bar" and "q". However, any such difference is likely to be small and of little significance. Technically, according to the language specification, "q", "bar", and the function arguments "a","b","c" are in different scope contours. Allen _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss