> The problem is that imports are not normal variable assignments. They
> do not copy values, like normal destructuring, they are aliasing
> bindings! If you were to allow arbitrary expressions and patterns,
> then this would imply aliasing of arbitrary object properties. Not
> only is this a completely new feature, it also is rather questionable
> -- the aliased location might disappear, because objects are mutable.


Could it be structured so that using `export` directly on a variable exported 
the alias, while using `import { x: [ a, b ] } from A; ` was basically just 
sugar for `import { x } from A; let [ a, b ] = x;` so that a and b copied not 
aliased? Example:     module A {        export let x = { a: 1, b: 2 };        
export function f() { x = { a: 3, b: 4 }; };    }     ...     import { x: { a, 
b }, f } from A;    f();    print(a); // 1    print(b); // 2     ...     import 
{ x, f } from A;    f();    print(x.a); // 3    print(x.b); // 4                
                     
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to