[erlang-questions] -import/1 and R16

Roberto Aloi <>
Fri Mar 22 17:09:52 CET 2013


Hi all,

I have noticed that the behaviour of the `import` module attribute slightly
changed in R16. Specifically, it's not possible to use the `-import/1`
variant anymore to import all functions from an external module. You need
to use the `import/2` variant and to explicitly list all function names and
their arity:

http://www.erlang.org/doc/reference_manual/modules.html

This discourage usage of the `import` attribute, which is a good thing in
general. On the other side, there is plenty of legacy code relying on this
attribute. Compilation for this code will fail under R16B due to a "bad
import declaration".

There are also some leftover for `-import/1` in the OTP code. As an
example, `erl_syntax_lib` stil believes that an atom could be returned by
the `attribute_arguments/1` function:

https://github.com/erlang/otp/blob/maint/lib/syntax_tools/src/erl_syntax_lib.erl#L1537

I'm curious about why this change hasn't been explicitly mentioned in the
change-log for R16A/B. Am I missing something obvious?

Cheers,

-- 
Roberto Aloi
---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130322/48ad0860/attachment.html>


More information about the erlang-questions mailing list