[erlang-questions] lists:reverse/1 as a built-in function

Christian S <>
Wed Jan 24 14:11:10 CET 2007


On 1/24/07, Erlang list <> wrote:
> What about also adding in module aliases at the same time?  If you had
> -alias(mypkg, erlang). as a way of saying that mypkg:* is an alias
> for erlang:* you might help or avoid a lot of migration issues.
> Alternatively, you could have compiler switches instead.

This would break existing semantics. I think it would be worth it
though (if accompanied by Richard O'Keefe's reified environments idea
[1]).

Right now we do not have actual module objects, we only have names for
them. The alternative you represent would mean that the module name
"foo" could refer to different modules (or no module at all) when
called as Mod:fun() from other modules.

Unless you suggest that aliases to have larger scope than modules? Site wide?

If there was a "module object", a new type, one could resolve the name
"foo" into a module object, and then use that module object when
calling Mod:fun().

This opens up some questions on how module versioning should be handled.

If one were to cheat, one could add a layer of indirection by having
the global module name-space to be made of references instead of
atoms, and have each module use a private mapping of atom module-names
to reference module-names.

If something like this was done, one would necessarily have to look
through lots of code.

[1]: http://www.erlang.org/pipermail/erlang-questions/2006-November/024026.html



More information about the erlang-questions mailing list