Yes. The RHS of a let binding is a dynamic expression, and involves no static
checking. The RHS of an import is a static module expression with validation --
it checks that the thing you're importing exists, and also prevents you from
importing the same name multiple times.
For example:
module M { export var foo = 42 }
let { bar } = M; // dynamic error, not statically caught
vs
module M { export var foo = 42 }
import M.bar; // static error
And also:
module M { export var foo = 42 }
module N { export var foo = "foo" }
let { foo } = M;
let { foo } = N; // either shadows or reassigns, no error
vs
module M { export var foo = 42 }
module N { export var foo = "foo" }
import M.foo;
import N.foo; // static error
Dave
On Apr 7, 2011, at 6:51 PM, Erik Arvidsson wrote:
> On Thu, Apr 7, 2011 at 12:20, Brendan Eich <[email protected]> wrote:
>> Fortunately there's a short-hand:
>>
>> let {draw, move} = GraphixAPIObject;
>
> Given this, is there any reason for anything but "import ModuleName.*" then?
>
> --
> erik
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss