tags:

views:

149

answers:

3

I can't figure out how to import all the functions of a module without having to specify the individual functions.

+3  A: 

It is not possible to import all functions from a module.

Christian
+5  A: 

As Christian says, "It is not possible to import all functions from a module." The compiler has no import_all directive and I think this is done deliberately to discourage excessive function importing.

Importing functions instead of fully qualifying them M:F(...) is usually bad style. There is a semantic difference between calling a module-local function and a function in another module (code-loading rules), so I think it's best to make foreign calls explicit. One could possibly make exceptions for importing dict/lists/sets module functions, as those are commonly understood and are unlikely to change during a code upgrade.

archaelus
+2  A: 

Reading from the Erlang Programming Rules:

Don't use -import, using it makes the code harder to read since you cannot directly see in what module a function is defined. Use exref (Cross Reference Tool) to find module dependencies.

Roberto Aloi