-
Notifications
You must be signed in to change notification settings - Fork 236
R6 classes support #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Cross posted on R6 repo: r-lib/R6#3 |
Bump. I really want to try this but I need a way of creating good docs. |
Just a bump to show my support for adding support for R6 |
Still no progress on this? |
Started work on https://github.com/imanuelcostigan/roxygen/tree/r6. But far too early to a submit a pull request. Comments and guidance (@hadley) welcome. |
If anyone wanted to work on this, the place to start would be what the output should look like, i.e. what should the Rd file for a RC/R6 class look like? |
To begin with, here's an example of what roxygen is currently (as of 4.1.1) capable of processing: #' RC implementation of Queue
#'
#' A simple example of what is possible using roxygen 4.1.1
#'
#' @field queue a list of items in the queue
#' @examples
#' (qrc <- QueueRC(5, 6, "foo"))
#' qrc$add("add something")
#' qrc$add("and something else")
#' qrc$remove()
#' @export
QueueRC <- setRefClass("Queue",
fields = list(
queue = "list"),
methods = list(
initialize = function (...) {
"Initialises queue"
for (item in list(...)) {
add(item)
}
},
add = function(x) {
"Add x to the end of the queue"
queue <<- c(queue, list(x))
invisible(.self)
},
remove = function () {
"Remove first item off the queue. Returns NULL of the queue is empty"
if (length() == 0) return(NULL)
head <- queue[[1]]
queue <<- queue[-1]
head
},
length = function () {
"Returns the length of the queue"
base::length(queue)
}
)) The result is: |
ReferenceClasses have three key bits that require documentation:
Of these, roxygen is capable of doing 1 and 2 but not 3 (AFAIK). In contrast, R6 has three key bits that should be documented:
|
Simple docstring comments for each class menthod is not acceptable. There On Mon, Aug 10, 2015 at 7:20 AM, Imanuel Costigan [email protected]
Ryan Hope, M.S. |
@RyanHope I agree. What I provided above is what is possible at the moment. |
@RyanHope why don't you show an example of an Rd file that looks the way you want? Otherwise you're not contributing much to making this feature happen. |
I think how R6 methods are documented is a bigger issue than what the On Tue, Aug 11, 2015 at 11:31 AM, Hadley Wickham [email protected]
Ryan Hope, M.S. |
@RyanHope it is the only issue. If someone could present a reasonable starting place for what the output should look like it, I could make it happen. No one seems to be willing to put in any time thinking about it, so it's not high on my priorities. |
I will put some time into this next week once I get back from a conference. On Thu, Aug 13, 2015 at 9:25 AM, Hadley Wickham [email protected]
Ryan Hope, M.S. |
If someone puts together a concrete proposal, please open a new issue. |
For anyone else arriving here from Stack or Google...in the absence of first-class support in One day I'm going to come back here and drop a suggestion for doing this in Anyway, hope |
R6 classes are new object oriented classes that also support pass-by-reference. See: http://cran.r-project.org/web/packages/R6/index.html
It seems that Roxygen could do something similar to what is doing with reference classes to get this working.
Is this something in the works already?
thanks
Fred
The text was updated successfully, but these errors were encountered: