Global lexical tier
Brendan Eich
brendan at mozilla.org
Thu Sep 3 01:50:37 UTC 2015
Andreas Rossberg wrote:
> On 3 September 2015 at 01:58, Brendan Eich <brendan at mozilla.org
> <mailto:brendan at mozilla.org>> wrote:
>
> 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.
>
>
> I still maintain that a tower-of-nested-scopes model would have been
> cleaner AND would have avoided both the shadowing issue and the REPL
> restriction. A mutable scope that gets extended under your feet is
> terrible, lexical or not.
I don't remember you overcoming the counterarguments about async scripts
and event handlers in async-generated/written markup twisting the nested
scopes unexpectedly.
> I also maintain that putting lexical bindings onto the global object
> is not an option. It is incompatible with having a TDZ, unless one
> wants to introduce TDZs for properties into the object model,
Nope!
> which I doubt anybody wants. Or unless one makes toplevel binding
> semantics completely different (and insane), which I also hope nobody
> wants (though I'm not so sure).
Something has to give. This seems least bad.
> 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.
>
>
> AFAICS this issue is completely orthogonal to sloppy-vs-script, and
> there are no new effects specific to sloppy mode. V8 already fully
> implements the necessary semantics. It wasn't pretty, but there are
> uglier things in ES6.
There's still user not implementor feedback to be gained by V8
supporting top-level let/const/class in sloppy mode per spec, but fair
enough.
> The main thing holding back sloppy let in V8 right now is the parsing
> nonsense and extra look-ahead required, which turns out to be a major
> pain for us (and FWIW, slows down the V8 parser by a couple of percent
> with little hope for recovery :( ).
I thought we resolved this (non-simple parameter list in function makes
"use strict"; directive prologue an early error). What's left?
/be
More information about the es-discuss
mailing list