[erlang-questions] Multi-line comments in Erlang

Richard O'Keefe <>
Tue Dec 7 23:14:33 CET 2010


On 8/12/2010, at 4:32 AM, Zvi wrote:

> Hi,
> 
> Matlab/Octave has single line comments, like Erlang (i.e. starting
> with '%' sign). But it also have multi-line comments, like for
> example:
> 
> %{
> this is example
> of multi-line
> comments in Matlab
> %}
> 
> which is equivalent to:
> 
> %this is example
> %of multi-line
> %comments in Matlab
> 
> How difficult is to add comments like this to Erlang?

It's worth remembering that Erlang syntax is based on Prolog syntax,
and Prolog has always had PL/I-style /*...*/ comments.  Somewhere on
the way to Erlang, such comments were deliberately *removed* from
the language.

/* ... */ comments have no known advantages over % comments;
with adequate editing tools it is equally easy to "comment out"
or "comment in" a region either way and they are equally easy
to type or reformat.

However, /* ... */ comments come with several risks, which can
be ameliorated by syntax colouring to be sure, but not all programmers
can see.





More information about the erlang-questions mailing list