Standard modules - concept or concrete?

Brian Di Palma offler at gmail.com
Sat Jun 8 11:30:52 PDT 2013


On Sat, Jun 8, 2013 at 7:07 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>
> I think you misunderstand.  The requirement that modules not have free
> variables at compile time *includes* global references. I expect that
> development environments won't have a problem handling this or
> enforcing whatever properties you're looking for.

I think I see what you're saying. Let me just see if I'm correct.

At compile time any references in a module which are not explicitly
imported but are language globals will not cause compile errors.
Any references which aren't explicitly imported and aren't language
globals will cause a compile error?

So

module "test" {
    new Date();
}

is fine.

While

module "test2" {
    $
}

will throw an error unless you add the line

import $ from "jquery";

even if jQuery was available in the global scope and had been loaded
in by a normal script tag?


More information about the es-discuss mailing list