[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comment brackets



  As I see it we have gone full circle in our choice of a commenting
method for high level languages.  Initially we had the C in column
one of Fortran.  After you put that C in column one you could put anything
you wanted in the rest of the card.  The next stage, when we went to
freer formated languages, was the balanced comments.  And finally, in
ADA we revert to a LISP style convention, with `--' taking the place of `;'.
I think that it is great that some language designers have finally
realized that LISP was right all along.  I program mainly in lisp a C, 
which uses the PL/1 style /* ... */ and I much prefer the LISP style comment.
It allows me to comment every line if I want to, you can't do this with
/* ... */ , there is just too much baggage around the comment.  Also,
if you want to comment out a line or two of LISP, you can just put a 
`;' at the beginning of the lines to remove.  But in C, you cannot
surround the lines to comment out with /* ... */ if any of those line
contain comments! And finally, the prefered way of formatting a multi-line
comment in C is

 /*
  *  this is the first line
  *  and yet another line
  */

The reason for the added *'s is not that the language requires them, but
to keep reminding you that this is a comment and not program text.  Of
course in LISP, using `;' this is always done.


  I can see one use for #| ... |# and that is to surround large blocks
of text.  I can imagine including parts of documentation files in the
source code and dont want to see ugly `;'s in front of each line.  Another
case would be if you wrote a large section of documentation inline
and now want to right and left justify it.  When you send that block off
to the text justifier you don't want any extraneous semicolons around.

 To summarize, I can see a very limited use for #| ... |# and if such
a convention is adopted, I would ask that people only use it when
absolutely necessary.

 - john foderaro