Global lexical tier

Brendan Eich brendan at
Wed Sep 2 23:58:11 UTC 2015

saam barati wrote:
> Thanks. Reading now.
> I'm clearly bad at email :/

Naw, this stuff is always harder to find than it should be.

I was there, I just re-read and re-remembered. I do not agree with Allen 
that some tiny needle was uniquely threaded. Rather, an aesthetic 
preference for the new ES6 binding forms to have a lexical contour of 
their own when used at top level prevailed. This leads to problems, not 
all of which were known at the time -- but some problems were noted.

The REPL problem, where let z=z; makes a poison pill, could be coped 
with by ad-hoc REPL deviations from the spec -- at some cost. Let's set 
it aside.

The one-time change to a reference, from global object to lexical 
shadowing binding, is a serious flaw. Yes, it could happen due to 
explicit scope nesting, but the global scope is apparently uniform. 
There's no explicit delimiter.

The implementors seem to be rebelling but I'm not trying to stir up 
trouble. It would help if V8 did support let, etc. in sloppy mode. Then 
we might see open rebellion among two or more implementors.

When it comes to aesthetics vs. implementability and usability, we have 
to throw aesthetics under the bus. This is JavaScript, after all! :-P 
Ok, seriously, we did not actually make anything prettier. The top level 
is hopeless. All we did was leave a couple of hazards for implementors 
and users in ES6.

Making the new binding forms create global properties (or throw trying), 
as I implemented long ago for let in ES4 in SpiderMonkey, is ugly, but 
it does not introduce any net-new hazards.


More information about the es-discuss mailing list