ES6 modules (sorry...)

Frankie Bagnardi f.bagnardi at
Mon Jun 16 14:41:06 PDT 2014

The other big concern here is that in production, very few people are going
to be loading every JavaScript file asynchronously.  If there's magic,
there needs to be a reasonable way to handle bundling multiple ES6 files

The [current solution][1] turns it into common.js (or others) and does
destructuring.  You then use browserify or similar tools to get your
bundles.  Perhaps a whole tool for ES6 modules will rise, but we have to
make sure that the "magic" doesn't mean "only implementable natively".  It
needs to be something people can use today in ES5 browsers... or else we'll
have broken ES6 modules and no one will be able to use "real" ES6 modules.

I'm sure people working on the proposal thought of this, so what was the


On Mon, Jun 16, 2014 at 12:24 PM, C. Scott Ananian <ecmascript at>

> Another alternative is to introduce this funny "binding not
> destructing" behavior as a first-class language construct, so that one
> could do:
> ```
> let o = { f: 1 };
> let < f > = o;  // using your angle-bracket syntax for the sake of
> discussion
> o.f = 2;
> console.log(f); // prints '2'
> let < foo > = import "module"; // same syntax!
> ```
> Of course this is far too large a change for this late date, etc, etc.
> But my point is that "modules as objects" works well because it fits
> well with the rest of the language.  If we want `f` to be an
> abbreviation for `o.f` then it would be nice if that binding behavior
> was part of the base language.
>   --scott
> ps. my personal preference is *not* to introduce new 'binding' syntax,
> but instead to imagine the values assigned as a result of the
> destructuring as being somewhat magical proxies which retain their tie
> to the original module object and reflect changes there.  Using
> proxies as a mental model of the semantics avoids having to muck
> around with the core notion of variable binding.  That is, it really
> is a `let`, and it really is ordinary `destructuring` -- all the magic
> resides in the particular value returned.
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list