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

Konstantin Vsochanov kost@REDACTED
Wed Feb 17 10:45:02 CET 2016


Hi!

I’m working with Erlang for two years now and enjoy every day of using
it. However, there are some strange  features I’m wondering about. One
of them -module() attribute.

 The module name is strictly defined by the name of the .erl file. You
can’t change module name with -module() attribute. But the the -module()
attribute is mandatory. Why? Why we need -module() attribute at all?
Maybe we can make -module() optional in next Erlang release? So we don’t
need to repeat file name in first string of every .erl file. Or maybe I
miss something important?

Feedback is appreciated!

- Konstantin Voschanov



More information about the erlang-questions mailing list