On 29 April 2013 16:24, Domenic Denicola <[email protected]> wrote:
> While this is starting to make a lot of sense to me, especially the 
> package-vs.-module concerns, I worry about trying to get it in ES6. Also, as 
> someone with an ES5 background, I don't see the value of lexically-named 
> modules, and so am happy to postpone them to ES7.
>
> Taken together, I think the minimal solution would be to remove explicit 
> module declaration entirely: that is, ES6 would just have `import`/`export`, 
> without any `module`.
>
> But this leaves the question of how to support the concatenative use case if 
> we don't have the ability to declare multiple modules in the same file. This 
> brings to mind two approaches:
>
> 1. Does SPDY alone solve the problem concatenation is meant to solve? I don't 
> know very much about SPDY but it's reasonable to assume browsers that support 
> ES6 modules will support SPDY, given current trends, and I know it makes some 
> vague moves in this direction.
>
> 2. Can the loader API be used instead? E.g. instead of the concatenated file 
> being
>
> ```js
> module "foo" { ... }
>
> module "bar" { ... }
> ```
>
> it could instead be
>
> ```js
> System.set("npm:foo", `...`);
> System.set("npm:bar", `...`);
> ```

I brought up this very suggestion as a "min-max" sort of compromise at
the March meeting, but it did not get much love. And I agree that it
isn't pretty, although it actually has some technical advantages, e.g.
enabling parallel parsing.

As for a SPDY-like mechanism, I absolutely believe that something
along these lines is the way to go, for two reasons:

1. My prediction is that in the mid-term future, concatenation will
actually become harmful to performance when the sources are already in
the browser cache, because it prevents a lot of parallelisation,
caching and/or work deferring that would otherwise be possible in the
VM.

2. The bundling and transmission issue is a problem far beyond JS
files, and needs to be solved on a more general level. Large web
applications like Gmail currently go to great length to optimize it
manually, across file types, and I believe that a purely JS modules
focused approach to bundling will not help them a iota, whatever we
do.

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

Reply via email to