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

Richard A. O'Keefe ok@REDACTED
Wed Feb 24 00:46:12 CET 2016



On 24/02/16 7:12 am, Judson Lester wrote:
> 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
That's pretty much what GHC does for Haskell; see
https://downloads.haskell.org/~ghc/7.0.1/docs/html/users_guide/separate-compilation.html

I find it a pain in the --s- (and more so in Java) because you end up 
with one
conceptual collection shotgunned across a fairly arbitrary set of 
directories.

We have the notion of an OASIS catalogue for SGML and XML.
I've used the acronym OASES without explaining it before:
   Organising Application Sources for Erlang Safely
At a minimum, a myapp.oases file could contain things like
{module, my_app_part_subpart, "src/myapp/part/subpart.erl"}.
It could allow things like
{module, my_app_otherPart, {zip,"src/myapp/lib.zip","otherPart.erl"}}.

There'd be a 'finderl $module' command that you could use to find
the file name corresponding to a particular module.

I have a half-written web page about this; it's definitely not ready to 
put up yet.




More information about the erlang-questions mailing list