[erlang-questions] Why we need a -module() attribute?

Steve Davis steven.charles.davis@REDACTED
Fri Feb 26 01:38:34 CET 2016


It works. It’s worked for years. Works is good. 

Being lazy is good as a developer if the end is to produce clearer functions. It is not to avoid a second or two of typing at a keyboard — for sure you should always be writing code for the *maintainer* not for yourself (though you may indeed be that actor too). 

Erlang has so little “boilerplate” that this discussion seems entirely pointless (IMHO).

If you wish to organize your source for convenience consider an Emakefile with a couple of lines like

%
{"src/*", [{i, "include"}, {outdir, "ebin"}, debug_info, strict_record_tests]}.
{"src/*/*", [{i, "include"}, {outdir, "ebin"}, debug_info, strict_record_tests]}.
{"src/*/*/*", [{i, "include"}, {outdir, "ebin"}, debug_info, strict_record_tests]}.

Yes, still the modules need to have unique names but surely duplicated module names will always lead to confused code eventually.

My 2c

/s


More information about the erlang-questions mailing list