On Nov 4, 2010, at 11:18 AM, Kris Zyp wrote:

> I was not suggesting desugaring into CommonJS require() calls.

I know, I said "to ES5". You have to desugar to something in the current ES5 + 
browser APIs target.


> The
> transport-style API I referred to actually works similar to the
> interaction module loader API [1] in terms of providing a set of
> dependencies ([1] uses a call to a load function), provides a callback
> for executing the script when the modules dependencies are available
> (like provideSource() call from [1]).

Providing only dynamic module loading, which is a good tool but not enough and 
*not right for the common case*, breaks the run-to-completion, apparently 
single-threaded JS execution model. People use require as if it were a special 
form, and indeed Caja and other systems (last I heard) preprocess accordingly, 
*and prefetch* to preserve run-to-completion.


> Based on the fact this is
> currently used mechanism in the simple modules proposal, it doesn't
> seem impossible to use API that it is suitable for ES5 code to work
> within.

This Harmony script:

<script type="harmony">
var invariant = 99;
module Foo = "foo";
import Foo.bar;
bar(invariant);
</script>

is not equivalent to anything like this:

<script>
var invariant = 99;
requestModule("foo", function (Foo) {
    Foo.bar(invariant);
});
</script>

because invariant could be varied by a later script or event handler.

This is precisely what I mean by "not possibly in the language currently".

/be

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

Reply via email to