Brendan Eich wrote:
Brandon Benvie wrote:
Unless I'm mistaken on how Spidermonkey handles function declarations
in block scope, almost none of those examples will work correctly in
Firefox. Most of them will work in every other major browser, but not
in Firefox.
No, that's not so. The ancient (pre-ES3) SpiderMonkey
function-in-block semantics are like an assignment expression in
effect, so if control flow reaches the nested function declaration,
the var-like binding will be *created* and initialized.
Astute students of ECMA-262 such as yourself probably see the
contradiction above: "assignment" != "definition". Indeed I started with
assignment ages ago but the code evolved to conditionally define (not
run global setter for same-named property for
function-in-block-in-global-code).
Anyway, the major point remains: the definition (originally, assignment)
happens only if control flow reaches the nested declaration.
/be
If control flow does not reach one of N possible for a given name,
then the var-like binding won't even exist.
Crazy but true.
The snippets Brian posted all look like they'll work in SpiderMonkey /
Firefox, at a glance from me. Let me know if I missed something.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss