[Rd] Any plans for commenting out region via something like " /* */ "?

Jan T. Kim jtk at cmp.uea.ac.uk
Wed Apr 27 00:46:11 CEST 2005

On Tue, Apr 26, 2005 at 05:22:42PM -0400, Roger D. Peng wrote:
> I realize this thread is a bit old, but it only just came to my 
> mind.  What about using a function like
> commentOut <- function(expr) { invisible() }
> and then
> commentOut({
> 	a <- 10
> 	bladfkljasdlkfj()
> 	blah blah blah
> })
> Lazy evaluation prevents the expression from being evaluated so 
> you don't have to worry about syntatic correctness.  And it nests 
> too (I believe).

This doesn't work too well, unfortunately. Firstly the argument(s) of
commentOut are still parsed, so if there is a syntax error (which creates
a problem during parsing), execution is halted. Furthermore, while
a series of statements (separated by newlines or semicolons) is not
acceptable as a function argument, so this approach is limited to
commenting out pieces that represent single expressions.

Best regards, Jan
 +- Jan T. Kim -------------------------------------------------------+
 |    *NEW*    email: jtk at cmp.uea.ac.uk                               |
 |    *NEW*    WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

More information about the R-devel mailing list