[erlang-questions] Multi-line comments in Erlang
Richard O'Keefe
ok@REDACTED
Thu Dec 9 21:58:21 CET 2010
On 9/12/2010, at 10:48 PM, Zvi . wrote:
> 1. The beauty of dynamic languages is that you don't need tools and IDEs!
What has this to do with >dynamic< languages?
The only language I use an IDE for is Smalltalk (which is dynamic).
Erlang/OTP comes with lots of tools.
As for editors, excluding help files, the editor I use is
13100 lines, 6770 SLOC, 381 kiB in size and originally ran
on PDP-11s and used to run on MS-DOS.
> 2. Comments are essentially Natural language (let's say US English)
> document, embedded into Programming language (Erlang) document.
People who ask for multiline and nesting comments often want them to
contain program text.
> Therefore, embedded document should be left intact.
This is not a valid conclusion. People who use Javadoc, Haddock (for
Haskell), PlDoc (for Prolog), or ErlDoc (for Erlang) *want* their
natural language text to be marked up in various ways and transformed
for display. There has long been a fashion in C for writing
/* long comments
* with stars at the
* beginning of every line
* and a lopside end
*/
which I have always found ugly. But the existence of that fashion
shows that there are many people who find value in their commentary
being explicitly marked.
> Ideally I would like comments to be something, like HEREDOC.
Other people want a clear and unambiguous separation between
what is commentary and what is not, so that you can look at
_any_ line in a file and instantly tell what you are looking at.
>
> 3. Free format is the king!
A non-sequitur. Ada is free format, but it has only -- end of line
comments. Fortran 95 is free format, but it has only ! end of line
comments.
> Language designers shouldn't dictate programmers
> how to format and ident their code.
Somebody forgot to tell Larry Wall and Guido van Rossum that;
they also forgot to tell the Haskell designers and the Occam designers.
> How differnt is starting comment line from '%' in Erlang, from putting 'C'
> or '*' in the first column in FORTRAN?
Very different. % in Erlang is like ! in Fortran: you can put it in
any column you choose.
>
> 4. In other languages, that doesn't have multiline comments I often use
> ifdef(false) macro, or outright if(false) to "comment out" parts of code.
This contradicts your earlier statement that the contents of multiline
comments are natural language text.
> I
> think it's uglier, than proper multiline comments, but still better than
> comment every single line.
Erlang also has -if.
More information about the erlang-questions
mailing list