At least, if you consider |with| and |eval| fun (and who doesn't?):
js> var x = "outer"; function f() { with({ x: 17 }) eval("var x"); return x;
} typeof f()
"undefined"
This seems to be the behavior in every engine out there. But according to the last ES5
errata for 10.5, and in the latest ES6 draft, since "x" has a binding in the
object environment record created when executing the |with| statement's substatement, and
the object supplied to the |with| isn't the global object, the |var x| should do nothing
whatsoever. Presumably given this implementation unanimity the spec should change on
this point.
In a certain sense this was flagged in
<https://mail.mozilla.org/pipermail/es5-discuss/2011-January/003882.html> in
acknowledging the current language to be narrowly scoped to the exact problem at
hand. I'm just pointing it out so it gets addressed in the likely future changes
that happen to 10.5.
Jeff
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss