A question about module/imports/exports

Shijun He hax.sfo at gmail.com
Mon Aug 27 02:46:00 PDT 2012


On Mon, Aug 27, 2012 at 2:11 PM, Luke Hoban <lukeh at microsoft.com> wrote:
>> And is there any difference if module A is write as:
>
>> module A {
>>   var _a = 'a'
>>   export function changeA(v) {
>>      a = v
>>   }
>>   export {a: _a}
>> }
>
> This should not work.  There is no value in scope inside the module 'A' with the name 'a' here.  The exported name 'a' is only available as a member of the module 'A' via 'A.a'.
>

Sorry I don't get it. Do you mean

import {a} in A // compile error?

but

A.a // accessible?


More information about the es-discuss mailing list