Global lexical tier

Rick Waldron waldron.rick at
Wed Sep 2 02:51:59 UTC 2015

On Tue, Sep 1, 2015 at 10:41 PM SaamBarati1 <saambarati1 at> wrote:

> Hi Allen,
> What were the requirements for the global lexical scope? Is it written
> somewhere I can read? I came up empty after a quick search of
> I think the whole point of ES6 lexical scoping is to limit scope to
> something you can read in a given file (or script, or block, or eval, or
> unit of JS code). Except, this breaks down for global top-level
> let/const/class. I argue that if you want these variables to be visible
> across JS programs, you should be using modules. The current spec makes
> this somewhat better than "var"s because these variables are no longer
> properties on the global object, but it punted and said that there is some
> magical lexical scope that wraps all programs. I think it's more in the
> spirit of lexical scoping to have these variables be limited to the program
> they're defined in (as if the entire program were wrapped in {}). And it's
> more in the spirit of ES6 to share code across programs using modules.
> I think it's not helpful for you to threaten that our opinions are less
> useful than a proof of impossibility when we are people who are both
> interested in the JavaScript language and interested in implementing it
> well. I've spent > 8 hours today implementing the "global lexical tier", so
> I think it's helpful to categorize my opinion as being slightly greater
> than "less useful than a proof that the spec is impossible to implement".
> Sometimes the best ideas are those that are negligent of "requirements".

Allen already provided links to discussions of record that lead to the
design in ES6. Those discussions capture the requirements and supporting
rationale. Here they are again:

plus various es-discuss threads:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list