[R] Block comments in R?

Duncan Murdoch murdoch at stats.uwo.ca
Mon Oct 9 14:16:28 CEST 2006


On 10/8/2006 8:03 PM, Richard A. O'Keefe wrote:
> Apparently misunderstanding the argument,
> BBands <bbands at gmail.com> wrote:
> 	Should R be editor specific? Or should it be editor neutral?
> 	
> R is, and should remain, editor-neutral.
> Amongst other things, it should NOT acquire misfeatures
> in order to support editors that happen not to support comment-region.
> 
> 	In my view blocks comments are a desirable, editor-neutral approach.
> 	
> Block comments are indeed editor-neutral,
> but they do not solve any problem that R currently has,
> and they ARE in practice highly error-prone.

I think they are only error-prone in editors that don't recognize them 
and highlight them as comments.  Some editors support comment-region, 
some don't; some highlight block comments properly, some don't.  The 
editors built into R don't handle either of these.

R source code is mostly C, which only supports block comments (using the 
strict compiler options we use); it also includes Fortran, which only 
supports prefix comments, Perl with both types, Bourne shell code with 
prefixes, and some others (including S, of course).

So R users are likely familiar with both styles of comments, and they 
probably have their own preferred style.  I don't think it's urgent to 
support both, but it would likely make some peoples' work easier, and 
wouldn't hurt anyone else too much.

Duncan Murdoch

> 
> 	Note that most of the more recent languages have some form of block
> 	comment capability.
> 	
> 	http://en.wikipedia.org/wiki/Comment#Summary
> 	
> That list is not a list of "more recent languages"; it is a list containing
> both old languages and new ones.  Some of the entries (such as the one for
> Algol 60), are clearly wrong.  (In fact the Algol one is doubly wrong,
> because the language always was Algol, not ALGOL.)  So is the Scheme entry
> wrong: there are no block comments in any official version of Scheme and
> never have been.  The list is missing Burroughs Algol (% end of line
> comments), Prolog (%...\n and /*...*/), Pop-2 (!...! or !...\n), and many
> others.  If you want to be pedantic, the list is technically wrong about
> C and C++.  We also find COBOL, with some interesting variants, missing.
> Texinfo is another one that's wrong.  Quite a lot of entries are wrong.
> If "more recent languages" just means languages that are still in use,
> it's a pity APL isn't there; the APL "lamp" character (comments are supposed
> to be illuminating, no?) U+235D is cute.
> 
> We find
>     - languages which have copied PL/I  (/* ... */)
>     - languages which have copied BCPL (//)
>     - languages which have copied Pascal (* ... *)
>     - languages which have copied sh (#)
>     - languages which have copied Burroughs Algol (%)
>     - Fortran (only ever end-of-line comments, first C and now !)
>     - BASIC (only end-of-line ' and REM comments, and you would certainly
>       have to call VB.net "recent")
>     - eclectic languages
> 
>     - languages designed for high reliability, notably Ada and Eiffel (--)
> 
> Basically, most language designers have pretty much blindly followed
> designs from the 1960s, with the notable exception of Ada and Eiffel.
> 
> The Haskell experience is instructive.  The Haskell designers thought they
> could put in nesting block comments {-...-} and make them work.  But it
> took several iterations of fiddling with the details, and they *still*
> don't work in every case.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list