> Regarding, "import M.*" via destructuring, it's also arguable whether we
> don't need it since it "looks like a with".
I don't see any sense in which it looks like a |with|. It's both syntactically
and semantically different. Syntactically, because it's a global (or
module-global) declaration rather than a local statement form, and
semantically, because it imports all the bindings at compile-time.
> then (theoretically!) why not to have `let {} = Mod`
because that is ambiguous with existing destructuring syntax
> (or any other syntax, e.g. let * = Mod)
because that would be dynamically evaluating the module expression and
dynamically importing all the bindings, and hence tantamount to |with|.
> But, IMO it just looks more complicated than import Mod.*.
I agree. Part of the point of import is to create a distinct syntactic context
for module expressions. Mixing this in with ordinary expressions and
destructuring confuses the issue.
>> (We've talked a little bit about generalizing the `require' form to be an
>> expression operator that does a static module load, but I'm not sure whether
>> it hangs together.)
>
> This is the question of allowing expression which we talked in the Narcissus
> list
No, it's a different issue. You were talking about export declarations. Here I
was talking about allowing you to statically load a module in any expression.
> (https://mail.mozilla.org/pipermail/narcissus/2011-March/000043.html ; btw,
> is it worth to put the discussing on duplications on this list?).
Not really. It's a pretty specific detail and we'll sort it out. It's not worth
spending time discussing.
> Though the other question is: why do we need `require` at all?
Purely for syntactic/practical reasons. Let's not bikeshed.
Dave
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss