Package support in Erlang: Status ?

Thomas Lindgren thomasl_erlang@REDACTED
Sun Apr 20 12:21:36 CEST 2003


--- Richard Carlsson <richardc@REDACTED> wrote:
> So far I've had almost no feedback at all from
> users, so if you read this
> and
> have tried using packages, then please do let
> everybody know what you think!
/.../
> So, if you want to move code from the current "flat"
> namespace into a
> package namespace, you have to:
> 
>         1. rename the module, by prefixing a package
> name
>         2. add an '-import(Mod)' for each
> non-package Mod that is being
> called.
> 
> and that's it. Note that existing code can call
> package modules without any
> changes - for example, you can give a module name as
> 'com.bigcorp.mycallback'
> to the good old gen_server, and everything works
> just as normal.

I tried using packages in my optimizer (granted, a
somewhat unusual application, but one that tends to
encounter these sorts of issues) and ran into a
problem with atoms used as module names.

In particular, the following two functions are not
equivalent in a "packaged" module foo.bar 
(try erlc -E):

-module(foo.bar).
-compile(export_all).

f1() -> m:f(X).

f2() -> Mod = m, Mod:f(X).

As I understand your papers, this is intentional. But
it also breaks referential transparency: one (compiler
or developer) can no longer just replace occurrences
of Mod with its value m (or in general, a variable
occurrence X with the value of X).

That spells needless semantic trouble for all
involved, in my experience. So, my suggestion is to
fix that undesirable feature interaction.

Best,
Thomas


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com



More information about the erlang-questions mailing list