Module import/export bindings

caridy caridy at gmail.com
Wed Mar 18 17:52:27 UTC 2015


ah, right, I was thinking about `x = y`. In any case, the same applies, import and export declarations will not break the mental model for assignments, initializations, etc, the result for the original example will be `42` / `"orig"`.

/caridy

> On Mar 18, 2015, at 1:11 PM, Mark S. Miller <erights at google.com> wrote:
> 
> I have not been following this thread, so my response may be out of context. But I have to point out that
> 
>     let x = y;
> 
> is *not* an assignment. It is an initialization.
> 
> 
> 
> 
> On Wed, Mar 18, 2015 at 12:34 PM, caridy <caridy at gmail.com <mailto:caridy at gmail.com>> wrote:
> Kyle, same answer, `let x = y` is just an assignment. btw, you cannot change `y` in that module, that's a static error.
> 
> /caridy
> 
> > On Mar 18, 2015, at 12:26 PM, Kyle Simpson <getify at gmail.com <mailto:getify at gmail.com>> wrote:
> >
> >> we are NOT changing the semantic of the assignment expression.
> >
> > So the result is going to be `42` / `"orig"`, right? :)
> >
> > The reason I asked is not because I thought we were changing the semantic of the assignment expression, but because I wasn't sure if this top-level "const or whatever binding" was some sort of special thing that you can only hold a reference to. Clearly not.
> >
> > Also, since `y` keeps a reference to the "orig"inal function reference imported, even if the module updates itself, this very well may affect those who (in places other than this thread, and for different reasons) have often suggested they plan to do stuff like:
> >
> > ```js
> > import { y } from "..";
> >
> > let x = y;
> > ..
> > // use x now
> > ```
> >
> > In those cases, I was trying to find out if `x` could be updated by the module itself, like `y` can, because that matters (either good or bad) to the desire to use such a pattern. Since `x` can't get updated here, it's now clear to me that I wouldn't want to use such pattern, for fear that I am not using the latest API binding.
> >
> > Thanks for clarifications!
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
> > https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
> https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>
> 
> 
> 
> -- 
>     Cheers,
>     --MarkM

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150318/e74aaa15/attachment.html>


More information about the es-discuss mailing list