I can't figure out how to import all the functions of a modul开发者_运维百科e without having to specify the individual functions.
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.
It is not possible to import all functions from a module.
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.
精彩评论