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

Judson Lester <>
Tue Feb 23 19:12:26 CET 2016


For a while now, I've wished I could have more control over where module
source files were on the filesystem. For example, instead of

src/myapp_part_subpart.erl:
-module(myapp_part_subpart).

I'd really like to be able to put that in src/myapp/part/subpart.erl -
maybe this is a misapprehension turned superstition, but I was under the
impression that I'd need to have a whole separate build step to copy the
latter into the former before handing it to erlc. Is that not the case? I'm
pretty ambivalent about the extra step and the extra set of files vs. being
able to name files as I'd like to, and if there's a way to get that to
happen in one step I'd love to learn about it.

Judson

On Mon, Feb 22, 2016 at 3:12 PM Richard A. O'Keefe <>
wrote:

> The little AWK program is indeed neat, but it goes in the broken direction
> (from file name to module name) not the working direction (from module
> name to file name).  This is the whole problem: given a file name,
> we cannot cross-platform reliably reconstruct a module name.
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160223/96e9ff5a/attachment.html>


More information about the erlang-questions mailing list