This was the point I was explaining here:

    https://mail.mozilla.org/pipermail/es-discuss/2010-May/011162.html

Modules are static entities, whose structure is known at compile-time. The 
"module" form creates these static bindings. But they can be reflected as 
first-class values. (Similar to e.g. classes in Java and proposed ES4.)

The "import" form, like "var" and "const" and "function" creates a binding to a 
first-class value, whereas the "module" form creates a static module binding.

So when you write:

    var x = Math;

you create a variable binding to the reflected first-class module value. 
Whereas when you write:

    module x = Math;

you are creating a static module binding x which is bound to the static module 
bound to Math.

Dave

On May 16, 2010, at 9:15 PM, Kevin Curtis wrote:

> On Mon, May 17, 2010 at 3:27 AM, David Herman <dher...@mozilla.com> wrote:
>> This makes it very convenient to reflect them as first-class values:
>> 
>>    var x = Math;
>>    alert(x["sum"]); // function(x,y) { ... }
>>    alert(x["thisIsNotDefined"]); // undefined
>> 
> 
> Whats the difference between:
> var x = Math; // or: const x = Math;
> 
> And:
> module x = Math;
> 
> Thanks.
> --

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to