[Rd] calls with comment attribute

William Dunlap wdun|@p @end|ng |rom t|bco@com
Wed Nov 13 04:15:11 CET 2019


I suspect that the parser used it to store comments, including the initial
"#", before R started using the srcref attribute.  (S also stored comments
in the parse tree.)

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Nov 12, 2019 at 4:16 PM Duncan Murdoch <murdoch.duncan using gmail.com>
wrote:

> On 12/11/2019 5:01 p.m., William Dunlap via R-devel wrote:
> > In general R doesn't print the "comment" attribute of an object
> >     > structure(1:3, comment=c("a comment", "another comment"))
> >     [1] 1 2 3
> > but if the object is a call it prints it in an unusual format
> >     > structure(quote(func(arg)), comment=c("a comment", "another
> comment"))
> >     a comment
> >     another comment
> >     func(arg)
> >
> > What is the rationale for the special treatment of calls?
>
> It was there in revision 2 of src/main/deparse.c in 1997.  (For those
> unfamiliar with R history:  the current revision of R is 77405.  That
> particular file has been revised 248 times since rev 2.)
>
> I suspect either nobody has noticed it before, or nobody had the nerve
> to touch it.
>
> Duncan Murdoch
>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list