Packages in Erlang: new documentation

Richard Carlsson richardc@REDACTED
Wed Sep 3 15:55:17 CEST 2003


On Wed, 3 Sep 2003, Luke Gorrie wrote:

> Do you have any real-program examples? From the spec alone packages
> seem to complicate things with no obvious gain. But perhaps seeing
> some pretty programs without "mymod_" strewn about them would provide
> the necessary temptation?

Alas, not yet. Maybe when I release the next version of EDoc.

> I suppose that etags and distel will both need updating to resolve
> package names if they're to work on such code.

Yes, and probably the emacs mode needs a little hacking by someone
who knows how...

> But it looks like you can fully resolve packages from the source file
> alone, thanks to excluding 'import_all' - is that right?

Yes. This was a design decision. You don't need to compile modules
together in order to make them work.

> In Java you can't do that, e.g. in:
>
>   import foo.*;
>   import bar.*;
>   ... {
>     Baz.beer();
>   }
>
> To resolve 'Baz' you need to go running around the code-path to see if
> it's in the 'foo' or 'bar' package.

And in Erlang, you could end up with some really strange runtime errors
if you recompiled the system with a code path that differs from the one
used by the original author or vendor. That's another important reason
why that kind of import is not available.

	/Richard


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list