Module import/export bindings

caridy caridy at gmail.com
Wed Mar 18 16:11:35 UTC 2015


Kyle, we are NOT changing the semantic of the assignment expression. Your example has nothing to do with import/export ;)

/caridy

> On Mar 18, 2015, at 10:26 AM, Kyle Simpson <getify at gmail.com> wrote:
> 
> 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"`
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list