ES6 modules (sorry...)
Jasper St. Pierre
jstpierre at mecheye.net
Mon Jun 16 10:41:50 PDT 2014
On Mon, Jun 16, 2014 at 1:22 PM, Rick Waldron <waldron.rick at gmail.com>
wrote:
>
> On Mon, Jun 16, 2014 at 1:05 PM, Calvin Metcalf <calvin.metcalf at gmail.com>
> wrote:
>
>> e.g. something like
>> https://gist.github.com/calvinmetcalf/9252f41bf6e3c8b4add7
>>
>
> re:
>
> let { foo, bar } = import "library";
>
> Ignoring the UnaryExpression ambiguity, what happens here:
>
>
> // library.js
> export const MAX_VALUE = 1023;
>
>
> // program.js
> let { MAX_VALUE } = import "library";
> MAX_VALUE = 1;
>
Seems like a straightforward thing to me. "let" creates a local binding for
the scope of the file. It shouldn't be anything different from:
function importMyLibrary() {
let module = import "library";
return module;
}
let { MAX_VALUE } = importMyLibrary();
MAX_VALUE = 1;
Or:
function importMyLibrary() {
let module = import "library";
let MAX_VALUE = module.MAX_VALUE;
return { MAX_VALUE: MAX_VALUE };
}
> Rick
>
_______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
--
Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140616/1715e110/attachment.html>
More information about the es-discuss
mailing list