Standard modules - concept or concrete?

Kevin Smith zenparsing at gmail.com
Wed Jun 19 08:50:43 PDT 2013


>
> Note that there are situations where you can still get a
> ReferenceError inside a module, by deleting properties off of
> `window`.   Ruling this out would require:
>
> 1. not giving modules access to the global scope, or
> 2. changing the global object when compiling modules
>
> Neither of these seem like good ideas.
>
>
I agree.  I wonder, though, why my previous example should work, but this
should fail:

    // Before linking, window.bar is not defined

    // foo.js
    window.bar = "bar";

    // main.js
    import "foo";
    console.log(bar); // Link time error

But if we ran "foo" in a previous linking/execution pass, then it would
work.

Since this is a departure from the current non-module handling of global
object variable references, what is the motivation?

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130619/4fdbc07a/attachment.html>


More information about the es-discuss mailing list