Re: [R] Block comments in R?

From: Richard A. O'Keefe <ok_at_cs.otago.ac.nz>
Date: Thu 05 Oct 2006 - 22:58:50 GMT


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).



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Oct 06 09:01:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 06 Oct 2006 - 09:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.