`import` and aliasing bindings

David Herman dherman at mozilla.com
Fri Dec 28 09:43:33 PST 2012

On Dec 28, 2012, at 9:39 AM, Domenic Denicola <domenic at domenicdenicola.com> wrote:

> On Dec 28, 2012, at 12:28, "David Herman" <dherman at mozilla.com> wrote:
>> Another example where this could come up is initialization. Since imports tend to be at the beginning of a module, you could end up reading the value of a not-yet-initialized variable too soon.
> A code example of this would be awesome. Also, is it a problem ES5 module systems fail to address?

It can come up with mutual recursion between modules, which ES5 module systems famously handle poorly. Here's an example, untested, obviously :)

// a.js
import { B } from "b";

export class A {
    m() { return new B }

// b.js
import { A } from "a";

export class B {
    m() { return new A }


More information about the es-discuss mailing list