Global lexical tier

Andreas Rossberg rossberg at google.com
Thu Sep 3 21:52:18 UTC 2015


On 3 September 2015 at 20:57, Brendan Eich <brendan at mozilla.org> wrote:

> Andreas Rossberg wrote:
>
>> On 3 September 2015 at 03:50, Brendan Eich <brendan at mozilla.org <mailto:
>> brendan at mozilla.org>> wrote:
>>
>>     I don't remember you overcoming the counterarguments about async
>>     scripts and event handlers in async-generated/written markup
>>     twisting the nested scopes unexpectedly.
>>
>>
>> The only cases where the scope order would make an observable difference
>> are ones that produce conflicts right now. So you'd only allow a few more
>> programs -- somewhat ill-behaved (non-deterministic) ones, but no more
>> ill-behaved than those that you can write with `var` today (or could with
>> `let` if it was a property on the global object! -- non-deterministic
>> shadowing  is still a less drastic effect than non-deterministic
>> overwriting).
>>
>
> The problem is the cognitive model and load. Nothing helps
> non-deterministic loading of scripts with global effects, but making every.
> last. script! nest a fresh lexical scope means "now you have two problems".
>

What I mean is that in a model with mutable scope (or worse, the global
object) _declarations_ themselves become global effects. Later conflicts
can affect all code that has been loaded _before_, e.g. by smashing over an
existing binding.

/Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150903/6e81372c/attachment.html>


More information about the es-discuss mailing list