ES3.1 Draft: 11 June 2008 version available
Garrett Smith
dhtmlkitchen at gmail.com
Sat Jun 14 23:43:13 PDT 2008
On Sat, Jun 14, 2008 at 10:49 PM, Maciej Stachowiak <mjs at apple.com> wrote:
>
> On Jun 14, 2008, at 12:21 PM, Mark S. Miller wrote:
>
>> On Fri, Jun 13, 2008 at 2:44 PM, Mark Miller <erights at gmail.com>
>> wrote:
>>> On Fri, Jun 13, 2008 at 11:20 AM, Lars Hansen <lhansen at adobe.com>
> Named function expressions have the same kind of problem as try/catch
> (assuming the problem is a random non-activation object being on the
> scope chain).
>
On the front of the scope chain, in fact:-
The production FunctionExpression : function Identifier (
FormalParameterListopt ){ FunctionBody } is evaluated as follows:
1. Create a new object as if by the expression new Object().
2. Add Result(1) to the front of the scope chain.
- This is stated in 10.1.4 Scope Chain and Identifier Resolution:
"During execution within an execution context, the scope chain of the
execution context is affected only by with statements (see 12.10) and
catch clauses (see 12.14)."
The spec doesn't mention that FunctionExpression with Identifier can
affect scope chain. Example:-
(function f() {
var propertyIsEnumerable = 0;
(function f() {
alert(propertyIsEnumerable); //=> native code
})();
})();
Garrett
> Regards,
> Maciej
More information about the Es4-discuss
mailing list