-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Basically inconsequential suggestion, but I was curious how your package worked and I noticed the capture.output(print(fun))
line in read_docstring
,
https://github.com/Dasonk/docstring/blob/master/R/read_docstring.R#L17
I had guessed prior that it would be an application of body
but that doesn't return the comments. So I dug around to figure out where print
is finding the source code and I noticed it's in the function's attributes
as.character(attr(f, "srcref"))
This would avoid ever hitting the output stream. And would also work for function objects with overloaded print methods (not that those are very common).
Metadata
Metadata
Assignees
Labels
No labels