Module import/export bindings

Kyle Simpson getify at gmail.com
Wed Mar 18 14:26:11 UTC 2015


If you assign another variable from an imported binding, is that assignment done as a "reference to the binding" (aka creating another binding) or via normal reference-copy/value-copy assignment behavior?

```js
export var a = 42;
export function b() { console.log("orig"); };
export function change() {
   a = 100;
   b = function b() { console.log("new"); };
};
```

And then:

```js
import { a, b, change } from "...";

var x = a, y = b;

x;    // 42
y();  // "orig"

change();

a;    // 100
b();  // "new"

x;    // ??
y();  // ??
```

Will the final `x` and `y()` result in:

* `42` / `"orig"`
* `42` / `"new"`
* `100` / `"orig"`
* `100` / `"new"`



More information about the es-discuss mailing list