On Thu, Mar 22, 2012 at 3:06 PM, Sam Tobin-Hochstadt <[email protected]>
wrote:
> On Thu, Mar 22, 2012 at 5:11 PM, John J Barton
> <[email protected]> wrote:
>>
>> The module solution posted seems to have a top-notch solution for the
>> static case but the dynamic case is buried in the loader.
>
> I don't really understand what you mean by "buried in the loader".
>
> Here's the dynamic case:
>
> let $;
> system.load("http://code.jquery.com/jquery-1.7.2.js";, function(m) { $ =
m; });
>
> Is there something more that you're looking for here?

I mean that no such line or similar example appears in either
http://wiki.ecmascript.org/doku.php?id=harmony:modules
or
http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders

The examples on the former page are like:
   import "bar.js" as Bar;
   import y from Bar;
and all of the discussion is about this static form.

So I gather that the dynamic case would look like:

system.load(jqueryPath, function(m) {
    system.load(shimLibPath, function(n) {
        system.load(corpLibPath, function(o) {
            system.load(myLibPath, function (p) {
                import * from m;
                import * from n;
                import logHelper from o;
                import y from p;
                ...
            });
        });
    });
});

Is this correct?  To me this form looks like a poor cousin. Maybe its the
best we can do?

If I go back to my previous question, can we understand what should happen
here?

if (version === 1)
  import y from 'lib1.js';
else
  import y from 'lib2.js';

To me the answer should be that the lib1.js and lib2.js are fetched
(because I did not specify async). But they should not be executed (or
compiled IMO) until the statement executes. That does not seem to be what
Brendan thinks.

jjb
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to