[erlang-questions] avoid -import. Why?

Kenneth Lundin kenneth.lundin@REDACTED
Mon Jul 9 00:16:37 CEST 2007


The programming_rules document is quite old and need to be updated but
I think most of it is still valid.

I think the "don't use import is still as valid as it was when the
recommendation was
written. The code is usually much easier to read when you can see from
the syntax which module the function you are calling resides in and
that all
calls without module qualifier is local calls.

I know other variant of this rule where only very well known modules in stdlib
like lists are imported and all other calls uses explicit module qualifier.

The tool exref is replaced with xref since several years.

/Kenneth (OTP team at Ericsson)

On 7/9/07, Anthony Kong <anthony.hw.kong@REDACTED> wrote:
> Hi, all,
> In reading this resource (
> http://www.erlang.se/doc/programming_rules.shtml,
> ), I found this statement,
> 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.
> I do not think I understand why it is the case, and could not find the
> tool exref from the erlang distribution.
> If anyone can shed some light, most appreciate.
> Cheers, Anthony
> --
> /*--*/
> Experience is simply the name we give our mistakes.
> ---- Oscar Wilde
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list