Understanding module bindings

Brian Donovan me at brian-donovan.com
Tue Jun 24 10:03:22 PDT 2014


As Domenic said, your examples should be fine as long as the assignment
happens in the module that originally exports the bindings. This is how
I’ve implemented it with the new transpiler rewrite:
https://github.com/square/es6-module-transpiler/tree/rewrite-with-bindings/test/examples/bindings

Note that this would be an error:

import { a } from ‘./a’;
export { a };
a++;


On Mon, Jun 23, 2014 at 2:31 PM, Domenic Denicola <
domenic at domenicdenicola.com> wrote:

>  The exported values change, and any bindings created by import
> statements now reference the new values.
>  ------------------------------
> From: Guy Bedford <guybedford at gmail.com>
> Sent: ‎2014-‎06-‎23 17:30
> To: es-discuss <es-discuss at mozilla.org>
> Subject: Understanding module bindings
>
>  I was just looking to clarify how module bindings behave.
>
>  What happens in the following example:
>
>  export var template = '...template string...';
> export var counter = 0;
> export var obj = {};
>
>  template += 'post-script';
> counter++;
> obj = { new: 'obj' };
>
>  Do these throw an error? Does the exported value change, or does the
> internal value change only?
>
>  It would be good to make sure we're implementing this right.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140624/716b6dc1/attachment.html>


More information about the es-discuss mailing list