[R] Block comments in R?

Richard A. O'Keefe ok at cs.otago.ac.nz
Fri Oct 6 00:58:50 CEST 2006


Please let's not waste any time trying to figure out how to add
block comments to R.  In any guise they are highly error prone.
Although its precursors (PL/I and Pascal) had block comments and did not
have end-of-line comments, the programming language Ada was explicitly
designed to have end-of-line comments and not block comments, as block
comments were thought too easy to write incorrectly and too easy to misread.

As just one example, the version of vim I have does syntax highlighting,
BUT "Vim doesn't parse the whole file", so if you have code in the middle
of a block comment it may be highlighed incorrectly.

Commenting code out and providing documentation comments are easily
done with a good editor, although R documentation comments really belong
in files where help() can find them.

In the text editor I use, comment-region (using end-of-line comments)
and uncomment-region (ditto) are just two keystrokes each; it's
LESS effort than writing block comment delimiters would be.
Also, when writing a big comment, the newline key automatically
copies <white space>*(<end of line comment mark> <white space>*)?
to the beginning of a new line, so again it is less typing to make
a block comment using end-of-line comments than /* ... */ or anything
like that, and of course fill-paragraph and justify-paragraph (two
keystrokes each) can cope with the comment marks (a change from lines
with comment marks to ones without, or vice versa, constitutes a
paragraph break).



More information about the R-help mailing list