Global lexical tier
rossberg at google.com
Thu Sep 3 00:36:17 UTC 2015
On 3 September 2015 at 01:58, Brendan Eich <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 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, 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).
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.
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 :( ).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss