Erlang language issues

Bengt Kleberg eleberg@REDACTED
Mon Apr 22 12:30:37 CEST 2002

> X-Authentication-Warning: joe owned process doing -bs
> Date: Mon, 22 Apr 2002 10:42:41 +0200 (CEST)
> From: Joe Armstrong <joe@REDACTED>

> The principle reason for block comments is for the sake of edoc, since if
> people write lots of documentation in edoc it will look foul if every
> line of documentation is preceded by a %. 
> This is not only aesthetically displeasing but also it is a pain to
> edit - and yes if you have emacs and the right .el files I'm sure this
> can be fixed - but not everybody has emacs (I know they *should* but
> they don't).

one pain is that reformatting will put the %s all over the text.

>     A) We tag all the comments, leaving the code untagged (this is
>        what most languages do.
> or
>     B) We tag all the code leaving the comments untagged.
> Of the two conventions we chose, of course, the wrong one - A) when it
> should  have been  B)  -  what we  should  have done  was  to use  the
> "literate comment"  convention in Haskell  - we should have  said "all
> lines beginning with %" are code - the rest are comments.

good idea. you should have thought of that a little bit earlier. :-)

> So as an alternative to block comments I'd happily consider "literate
> Erlang" where the comment convention is reversed.

this is surly a better solution than block comments.


> Block comments have several advantages, not the least of which is they
> save your fingers and are environmentally friendly.

i use an editor (not emacs) to add % first. the selection and adding is
done with a mouse, something that saves greatly upon my fingers.

> Why environmentally friendly?
> Less characters = less space = smaller disks = less disk factories =
> less pollution.

you forgot :-)

> The only *disadvantage* is that you might comment out a large block of
> code which you don't easily see when you are editing. What can we do
> about that?

sofar the compiler has always told me when code is missing. if i manage
to remove both the -export() and the code, then i would lose.
but my main objection to block comments is that i am far more likely to
confuse myself and others by doing the following with block comments
(this was actually a C code example that used #ifdefs):

/* start1

lots of comments
and code

/* start2

lots of comments
and code

end 2 */

/* start3

lots of comments

end1 */

lots of comments
and code

end3 */

guess what happened when i (the maintainer) tried to get rid of the
start3 code that was no longer needed?


More information about the erlang-questions mailing list