Assigning to globals in strict mode

David Herman dherman at
Tue Oct 19 18:05:52 PDT 2010

> In harmony you have a purely lexical scope, eg. the global object is not at the head of the scope chain.  That means all unqualified names can be resolved statically so all these errors become early errors.
> In ES5 there is both with() and the global object that make early errors incompatible.

Agreed. Technically speaking, since `with' is disallowed in ES5 strict, we could theoretically start patching up the global object semantics to try to come up with ways of hacking lexical scope in there, but it's not what the spec says. Brendan is right: ES5 is done; static scope is work for Harmony.

Meanwhile, since ES5's errors are specified as dynamic, there's no avoiding weird corner cases like the ones that have come up in this thread. That's unfortunate, but it's the fault of the global object.


More information about the es5-discuss mailing list