Modules Question

David Herman dherman at mozilla.com
Tue Dec 28 10:30:38 PST 2010


There's some flexibility built in to the system via module loaders. The "filesystem modules" example is hypothetical; it assumes a built-in module loader that maps files available on the filesystem to corresponding pre-defined, nested modules.

On the web, you would do almost as you suggest:

> // a.js
> module a
> {
>     module b = "b.js";
> }

except that a.js doesn't name itself; it's named by the script that loads it:

    // a.js
    module b = "b.js";
    ...

    // b.js
    ...

    // project.html
    ...
    <script type="harmony">
    module a = "a.js";
    </script>

Dave

PS I will be updating the wiki pages soon to reflect some of the finer-grained details and tweaks I've made to the design based on my experience prototyping modules in Narcissus (http://github.com/mozilla/narcissus). I'll ping the list when the pages are updated.



More information about the es-discuss mailing list