modules, @std, selectively hiding/renaming imports

Brendan Eich brendan at mozilla.com
Sun Nov 20 10:09:21 PST 2011


On Nov 20, 2011, at 2:04 AM, Claus Reinke wrote:

> [btw: http://wiki.ecmascript.org/feed.php still gives me
>        url-encoded links; I thought that was meant to be
>       fixed by a wiki upgrade?]
> 
> From the early drafts of a standard library
> 
> http://wiki.ecmascript.org/doku.php?id=harmony:modules_standard
> 
> it appears we are headed for an import name clash between
> "Object.keys and "@iter.keys" - they cannot both be available as
> plain "keys".

Object is not a module, so there's no clash. Lots of methods named "keys" these days.

Also the recent es-discuss thread on @iter suggests eliminating it in favor of @reflect, which we want for Proxy helpers too.


> While the standard library needs a separate resolution, this
> situation is not at all untypical for module-based development.
> How are ES.next modules going to deal with this? We can locally
> rename an imported id, but I see no facilities for import hiding
> (import everything but a handful of ids), so how would we import
> everything while renaming a few ids?

We've mooted syntax for selective renaming, but import-all (import * from "...") lacks that feature in the current proposal. You'll have to be explicit in what you import.

This ok. * imports are for prototyping, one-offs where you control both modules, and the like. They are not for everything. And anyway, there's non conflict with Object.keys.

/be


More information about the es-discuss mailing list