FWIW: I've written down my understanding of the differences between LexicalEnvironment and VariableEnvironment in ECMA-262:
http://www.2ality.com/2011/04/ecmascript-5-spec-lexicalenvironment.html

Thanks, another surprising detail. The standard disallows
FunctionDeclaration as statement, acknowledges that
implementations don't follow suit, and recommends that
they should [12, Note].

Perhaps you should have used 'catch' instead of 'with' for
your example - the combination of
   - implementations allowing FunctionDeclaration as statement
- implementations differ in how such FunctionDeclarations are hoisted
   - ES/next limiting FunctionDeclaration hoisting to blocks

seems to imply that for some implementations, ES/next will
have different behaviour than ES5+FD-statements, for identical
program code (if I am reading this correctly, that is):

   function Outer() {
     var e = "Outer";
     try { throw "Inner"; }
     catch (e) {
function F() { log(e); } // some implementations hoist // 'F' without closing over 'e';
       F();                       // those have to change here for ES/next
       (function() { log(e); }());
       log(e);
     }
   }
   Outer();

My reading: some current implementations bind the 'e'
in 'F' to the 'Outer' 'e', while ES/next (and lexical scoping
intuition) will require a binding to the exception parameter.

Time for those implementations to change/raise warnings
now, before the switch? As is already recommended in the
current standard [12, note on page 86]..

I did not expect that.
Claus

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to