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

Éric Pailleau <>
Wed Feb 17 13:46:34 CET 2016


Hi,
I suppose it is necessary when building a module from an abstract code not coming from a file on disk.
Regards.

Le 17 févr. 2016 10:45 AM, Konstantin Vsochanov <> a écrit :
>
> 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
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions


More information about the erlang-questions mailing list