ES Modules: suggestions for improvement
dherman at mozilla.com
Wed Jun 27 11:08:56 PDT 2012
On Jun 27, 2012, at 10:58 AM, Kevin Smith wrote:
> The client chose to use *. You don't have to use * if you don't want to. It's a convenience.
> The convenience of * comes with a price, of course: (a) the inability to statically catch undeclared names without also anlayzing external files, (b) the hazard of name collisions, and (c) the inability for a reader to tell where names are coming from without automated analysis.
We intend to rule out (b) by disallowing import * from shadowing. But yes, the convenience does mean that the bindings are not explicitly named. That's the trade-off. I prefer to leave this trade-off to developers. Others prefer to make a unilateral ban on *. Reasonable people can disagree. But in my calculus, that argues for inclusion in the language and letting developers or teams make the decision for themselves whether to use it.
> Is it worth it? How can we tell?
By implementing it in SpiderMonkey! :) Seriously, though, we intend to build modules so people can get a feel for it.
I understand that import * is controversial. ES6 modules don't depend inherently on them. I believe that they're an important convenience for scripting. But they're not fundamental.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss