[erlang-questions] erlc: module definition requirement
Thu Jan 23 19:42:47 CET 2014
My reply to the same question in a comment to my latest blog:
That was a long time ago but I seem to remember that the "-module" came
first. This was part of the syntax and how you defined a module. The
requirement that the module name and the file name be the same came later
and is actually part of the libraries, both the compiler and the code
server. The compiler saves the BEAM code in a file with the same name as
the module while the code server assumes that the code in a BEAM is for a
module with the same name as the file. It would be easy for the compiler to
save the BEAM in a file with the same name as the module. This would need
no change to the code server. What you would need to do is take away the
warning/correction in emacs.
Seeing I view them, the module definition and the file name requirements,
as being different types of properties I don't think we should remove the
module definition. Changing the handling of the file names I would have
nothing against. It really doesn't worry me either way.
That's my opinion anyway.
On 23 January 2014 17:16, Tuncer Ayaz <> wrote:
> Is there a technical reason why a module without a -module(name)
> definition should not be accepted by compile:file/2?
> As it stands, filename and module definition of a module have to
> match, so why not remove the module definition requirement?
> I'm only talking about user edited .erl files.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions