[Rd] Multi-line comments in R

Simon Urbanek simon.urbanek at r-project.org
Wed Aug 19 15:19:50 CEST 2015


https://stat.ethz.ch/pipermail/r-help//2009-February/381039.html


> On Aug 19, 2015, at 12:16 AM, Nathan Esau <nesau at sfu.ca> wrote:
> 
> I was wondering why the decision was made long ago to never implement
> multi-line comments in R. I feel there are several argument to be made for
> why the R language should have multi-line comments.
> 
> 1. Many programming languages (including some which are commonly used for
> statistics, such as python, matlab and SAS) have this feature.
> 
> 2. Convenience - some editors may not support commenting out a selected
> region of code. This would provide a quick way of commenting and
> uncommenting code which could be useful when debugging. Also, if you have
> to type a lot of explanatory comments at the top of a code file, it can be
> frustrating to have to type "#" at the start of every line in some editors.
> 
> I can also think of a few reasons why R doesn't have multi-line comments or
> hasn't implemented them so far:
> 
> 1. Introducing a new multi-line comment delimiter, such as /* */ could
> destroy existing code.
> 
> 2. S didn't implement this feature (as far as I am aware), and R is heavily
> influenced by the design of the S language. Also, perhaps the community
> doesn't want this feature, and R is a community driven project.
> 
> 3. Perhaps this would be difficult to implement depending on the way that R
> parses source files. Is it even possible to make /* */ or a different
> delimiter do something like ``if(FALSE) { }``?
> 
> Nathan
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list