Four static scoping violations in ES5 sloppy
tschneidereit at gmail.com
Mon Mar 18 10:14:34 PDT 2013
Wasn't there some talk about an option to remove global from a
module's scope chain? Probably in the module loader? I seem to
remember that being discussed. I don't, however, remember ever seeing
a decision for or against such a solution.
On Mon, Mar 18, 2013 at 6:04 PM, Mark S. Miller <erights at google.com> wrote:
> Sadness. I had misremembered how all that finally resolved. In that moment,
> I thought we had decided to fix that for modules. But now that you mention
> it, I remember the discussion. These are difficult issues, and I was not
> trying to suggest we reopen them.
> In any case, regarding the new #1 and #3 restrictions in ES5 strict, the
> most we can say is that it cleared the ground in hopes of better scoping in
> ES6, but it didn't turn out that way. Oh well. Was worth a shot.
> On Mon, Mar 18, 2013 at 9:46 AM, Andreas Rossberg <rossberg at google.com>
>> On 18 March 2013 17:32, Mark S. Miller <erights at google.com> wrote:
>> > And why does ES5/strict impose these restrictions, when they are not
>> > necessary for the formal criterion?
>> > Because ES5 strict mode, being an opt-in, gave us a rare opportunity to
>> > clean things up in preparation for yet better scoping in ES6. I'm
>> > pleased to
>> > report that it mostly turned out that way. Because of #1 and #3, ES5
>> > strict
>> > code will be easier to refactor into ES6 modules, where the global
>> > object is
>> > finally not on their scope chain. At the time we did this, we didn't
>> > anticipate this specific aspect of ES6, but took the opportunity to
>> > clear
>> > the ground.
>> Maybe I misunderstand what you mean, but unfortunately, the global
>> object will remain at the top of the scope chain in ES6, even with
>> modules (though complemented with a lexical environment for new
>> binding forms). We shied away from fixing that mistake.
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss