I hope I'm not overlooking an existing feature. It would be great if there were a mechanism for inheriting method- and field documentation from a superclass. For me it is a very common use-case to have several subclasses of the same base class that have a similar interface but vary in the implementation details. In the following case I would want to inherit the whole documentation for ProcessorSmart$run() from Processor$run(), even if I am overriding the $run() method:
#' An Abstract Class
#' @export
Processor <- R6::R6Class(
"Processor",
public = list(
#' Process a dataset
#' @param x a `data.frame`
#' @return a processed`data.frame`
run = function(x) {
stop("Not implemented")
})
)
#' An Real Class
#' @export
ProcessorSmart <- R6::R6Class(
"ProcessorSmart",
inherit = Processor,
public = list(
run = function(x){
cat("implemented")
x
}
)
)
edit: edited for clarity, as non-overridden methods are inherited already and link to the base class. Though It still would be great to have the actual method documentation repeated on the subclass documentation page instead of just a link.
I hope I'm not overlooking an existing feature. It would be great if there were a mechanism for inheriting method- and field documentation from a superclass. For me it is a very common use-case to have several subclasses of the same base class that have a similar interface but vary in the implementation details. In the following case I would want to inherit the whole documentation for
ProcessorSmart$run()fromProcessor$run(), even if I am overriding the$run()method:edit: edited for clarity, as non-overridden methods are inherited already and link to the base class. Though It still would be great to have the actual method documentation repeated on the subclass documentation page instead of just a link.