Standard modules - concept or concrete?

Kevin Smith zenparsing at
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, is not defined

    // foo.js = "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

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: <>

More information about the es-discuss mailing list