Four static scoping violations in ES5 sloppy

Sam Tobin-Hochstadt samth at
Mon Mar 18 05:55:55 PDT 2013

On Mon, Mar 18, 2013 at 8:40 AM, Andreas Rossberg <rossberg at> wrote:
> Nothing, but Sam probably meant to write:
> if (something_random()) xxx = 7;
> xxx; // ReferenceError or not?

Right, I was confusing the problem this code describes, which is what
I think Mark meant, with the problem of the global object being on the
scope chain.

>> It actually demonstrates how the situation is exactly the same with *explicit* global variable creation. Strict mode does nothing to change the result.
>> Similarly, in case 3, the code could be `delete` and we still cannot statically predict whether there's a `ReferenceError` on the subsequent line or not. Again, strict mode does not change the result.
> That is true, and the proper answer is that the global object should
> be on the above list as well. Not sure why Mark did not include it.

I believe that Mark would distinguish 1-4, which are fixed by strict
mode, from the global object, which is the remaining issue in ES5.
But only Mark can answer this for sure.


More information about the es-discuss mailing list