On May 17, 2010, at 12:12 PM, David Herman wrote:

Coalescing requests (for some value of request) could be pushed down a layer, not specified as part of the ECMA-262 language. This serves the decoupling requirement. Is it enough? A while ago Allen wrote about separating "configuration management":

https://mail.mozilla.org/pipermail/es-discuss/2010-January/ 010686.html

Part of this was about version selection, but part of it was about "assembly" structuring. It seems worth working through this, both with a real implementation of simple modules, and with some thought experiments.

Yes, certainly. To some extent the module declaration syntax provides you enough to do this already:

    <!-- my configuration table -->
    <script type="harmony">
        module M1 = "m1.js";
        module M2 = "m2.js";
        ...
    </script>

But it might be nice to crystallize this in a restricted special form so browsers can reliably prefetch:

    <script type="harmony">
        module table {
            M1: "m1.js",
            M2: "m2.js",
            // ...
        }
    </script>

Either way allows prefetching once the type="harmony" script content has been parsed. But the browser still would have to stall rendering while that "module table" script tag was being processed, as far as I can tell. Any later scripts would block too, to avoid using a not-yet- loaded module binding.

Oh, but you probably meant that the module table form, besides being sugar, is written in a restricted language that cannot have effects other than to create module bindings -- cannot do document.write or document.createElementNS("script") or whatever. In that case we'd want type="harmony-module-table" or some such, and then such a script indeed would allow layout to proceed immediately, and not block rendering.

Thinking about it more, simple modules let authors bundle things in .js files, and src them with scripts. That's almost enough. Anything more, we do not want to standardize prematurely. Simple modules are really about lexical scope all the way up, and guaranteed errors (early errors, even), and static code partitioning with information hiding, and of course the lexical-only module-binding namespace management.

Which is all good. Prefetching and packaging are separable issues, we should keep thinking about them but I'd hate to try to "solve" them before considering simple modules as a proposal.

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

Reply via email to