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

Garrett Smith g@REDACTED
Mon Feb 22 05:24:08 CET 2016

On Sun, Feb 21, 2016, 21:04 Fred Hebert <mononcqc@REDACTED> wrote:

> On 02/21, Steve Vinoski wrote:
> >
> >If having an optional -module attribute is that important to you, write a
> >pull request.
> >
> I have written a program that does what is required and can be quite
> simply added to a tool such as erlang.mk.
>  $ awk 'NR==1 {x=FILENAME; gsub(/^.+\//, "", x); gsub(/\.erl$/, "", x);
> print "-module("x").\n" $0; next } !/^-module(.*).$/ {print}' $FILENAME
> If someone feels they would benefit from filenames taking over the
> module names, this script will fully edit out an existing
> `-module(name).` line and instead replace it taken from one using the
> filename.
> I hope this helps, please refine as you see fit, I'm releasing this as
> public domain.

OMG this so awesome!!!

Seriously, if you Reddit I will upvote.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160222/43ab6d51/attachment.htm>

More information about the erlang-questions mailing list