Comment on comment

Roger Price <>
Sat Jul 9 19:03:09 CEST 2005

I would like to suggest a clarification of the specification of a comment
in the Erlang Reference Manual section 1.4.3.  The current specification

« Comments are allowed anywhere within a module.  Comments start with the
character % and stop at end of line. »

I think it would be more precise to say:

Comments may be placed anywhere in a module except within strings and
atoms. The comment begins with the character "%", continues up to, but
does not include the next end-of-line, and has the value of white space.

Example 1 - a comment
"Hello World"  % Well known string

Example 2 - comment introduces white space
42> 12%
42> 34 .
** 2: syntax error before: 34 **

Example 3 - string and atom, not comments
46> {"% percent",'%%%%%'} .
{"% percent",'%%%%%'}


More information about the erlang-questions mailing list