On Fri, Nov 5, 2010 at 2:25 PM, Kris Zyp <[email protected]> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Another idea that might provide the extensibility to deal with loading
> various resources and alternate/older modules, what if we added the
> ability to specify the loader to use for a module:

This is of course possible with a module loader, and these are
interesting and valuable use cases.

> module myApp {
>   module Template = load "template.html" with "text-loader.js"; //
> load a template text
>   module Messages = load "messages.json" with "i18n.js"; // load some
> messages
>   module OldModule = load "old-module.js" with "commonjs-loader.js";
>   module NewShiny = load "a-harmony-module.js"; // use the default
> native harmony module loader
> ...

But I don't think using the declarative syntax for this is a good idea
- there's no static scope here; instead, there's arbitrary code
execution and evaluation.  Additionally, this makes everything
synchronous.  We want to keep the module syntax for
statically-resolved parts of the program, so that programmers and
implementations can reason in straightforward ways.  When you need
more dynamic behavior, that's what module loaders are for.

> I realize this may involve providing first-class objects to a
> second-class module system, but that doesn't seem impossible.

I don't understand this sentence.  Note that Simple Modules can
already be reified as module instance objects, but I don't think
that's what you're referring to here.
-- 
sam th
[email protected]
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to