[erlang-questions] packages woe

Ulf Wiger ulf@REDACTED
Sat Mar 10 16:26:47 CET 2007

I'm having some trouble with packages (yes, I know, I know...)

I had a generated module that looked like this (pretty-printed):

-import('.lists', [reverse/1]).

f(L) -> reverse(L).

Compiling it:

28> c(m).
./m.erl:3: bad module name '.lists'
./m.erl:6: function reverse/1 undefined

If I remove the single quotes in the import statement, it works, but it
works also in this case, which I think is strange:

f(L) -> reverse(L).

Looking at erl_lint, it converts the module name in import() to a string,
then calls packages:is_valid/1.


31> packages:is_valid(".lists").
32> packages:is_valid('.lists').
33> packages:is_valid('a.b.m').
34> packages:is_valid("a.b.m").

(So '.lists' was ok, according to packages, but since erl_lint converted
it to a string first, it suddenly wasn't...)

It seems as if module names with a leading "." are handled inconsistently.
The functions split/1 and concat/1 add to the confusion:

37> packages:split(.lists).
38> packages:split('.lists').
39> packages:concat(packages:split('.lists')).

Apparently, packages:concat/1 is not a proper inverse to packages:split/1.

Ulf W

More information about the erlang-questions mailing list