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

Richard A. O'Keefe ok@REDACTED
Fri Feb 26 00:38:02 CET 2016



On 25/02/16 11:36 pm, Loïc Hoguin wrote:
>
> I still run into this, mostly when refactoring. When moving code 
> around I usually end up with wrong separators. It's often in lists or 
> maps when writing one item per line. If I could have an optional comma 
> for the last item in the list I wouldn't have to compile, get an 
> error, fix it and compile again.

I think I wrote an EEP about that.  (Search search)
Yes, EEP 21, "Optional trailing comma for lists and tuples"

These days it should mention records and maps as well.
> I did rationalize it, "it's like sentences!" and you probably did too.

Actually, I thought "it's like Prolog."  Banged into a wall a couple of 
times:
"EXCEPT that most clauses end with a semicolon instead of a full stop."
Coming from Prolog meant that my personal style was to NEVER put
semicolons at the end of lines.

Maybe I should lay functions out like
     foo(...) ->
         ...
   ; foo(...) ->
         ...
   ; foo(...) ->
         ...
   .

My actual preference would be to simply say that an atom
or hyphen in column 1 implies either a semicolon or full stop
before it, whichever is appropriate.
> If you really never run into issues with them you either never 
> refactor code, do tools assisted refactoring or are smarter than 
> everyone else.
There's another possibility: I might refactor, but  just be too bad at 
it for this issue to be significant. (:-)





More information about the erlang-questions mailing list