[erlang-questions] Why we need a -module() attribute?
Wed Feb 17 15:37:50 CET 2016
From what I understand it's there to make sure it works on case
insensitive file systems. But I'm not sure this is an actual issue,
considering you have to give the file name to the compiler anyway, and
this file name could be considered the canonical module name +
extension. It's a problem that I believe tools should fix, not programmers.
On 02/17/2016 10:45 AM, Konstantin Vsochanov wrote:
> 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
Author of The Erlanger Playbook,
A book about software development using Erlang
More information about the erlang-questions