Comment #2 on issue 686 by [email protected]: "With" and function scope
http://code.google.com/p/v8/issues/detail?id=686

[email protected], ECMA-262 Editions 3 and 5 do not specify function declaration as a substatement. It is an extension, so Chapter 16 applies and implementations vary, with IE and (following it) Opera and WebKit engines hoisting the function to variable object scope, and Mozilla engines conditionally binding the name to a complete closure.

In the forthcoming "Harmony" edition(s) of the ECMA-262 standard, function in a braced block (braces are required; function declaration as unbraced sub-statement
consequent of "if" will be illegal) will bind a block-scoped,
block-hoisted/initialized lexical variable named by the function. But in that case the function in Fedor's testcase will entrain its scope chain, including the object
environment record induced by 'with'.

So SpiderMonkey's behavior is future-proof. But probably you'll want to wait for the
new edition of the standard.

/be

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to