Hello!

I've updated the strawman proposals for static modules and dynamic module 
loaders and would love to get feedback from the es-discuss community.

* Static modules:

    http://wiki.ecmascript.org/doku.php?id=strawman:simple_modules
    http://wiki.ecmascript.org/doku.php?id=strawman:simple_modules_examples

Briefly, the proposal provides a static module form:

    module Widgets { ... }

The declaration binds the module name lexically. Modules declared at the same 
scope can be mutually recursive. They can also be loaded from external URL's:

    module Even = "http://example.com/even.js";;
    module Odd = "http://example.com/odd.js";;

The body of a module contains nothing in scope except for outer module 
bindings. Modules are truly lexically scoped, with no global object pollution. 
Modules can easily import bindings from other modules, either by dereferencing 
the modules that are in scope directly:

    module Client { ... Widgets.messageBox("hello!"); ... }

or by importing them explicitly:

    module Client {
        import Widgets.messageBox;
        ...
        messageBox("hello!");
        ...
    }

Although modules are static entities, they can be dynamically reflected as 
objects.

There's plenty more details on the wiki page.

* Dynamic module loaders:

    http://wiki.ecmascript.org/doku.php?id=strawman:module_loaders

These provide an API for dynamically loading and evaluating modules, and 
creating separate isolated contexts in which modules can be evaluated. You can 
create a separate module loader that shares no module instances with the 
current module loader; this could be used e.g. by an IDE (such as Bespin) that 
wants to run client code without letting the client code affect the running 
environment of the IDE itself. You can also share some module instances, to 
have finer-grained control over the sharing between module loaders.

There are some API notes on the wiki page. I expect it'll be revised and 
refined over time. Feedback welcome!

Thanks,
Dave

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to