Closed jmp75 closed 9 years ago
:thumbsup:
Interesting -- I wasn't aware of utils::.DollarNames
. For the record, this is also related to #30.
Tab completions appear to just work with R6 in R 3.2.1, so maybe there was a change in R to support this?
I've tested this in RStudio and with R at the terminal, both in Linux.
AC <- R6Class("AC",
public = list(
x1 = 1,
x2 = 2
)
)
a <- AC$new()
# Press [tab] after this
a$
Very minor request, but is it possible to extend this in a nested manner?
Consider amended example:
AC <- R6Class("AC",
public = list(
x1 = function(){ invisible(self) },
x2 = 2
)
)
a <- AC$new()
While code completion works for x1, one cannot see x2 or any other members with, e.g.
a$x1()$
Whereas this is possible w/ magrittr pipes, e.g.
mtcars %>% select(mpg, cyl) %>% select( ) # [tab] yields remaining columns
I understand this is a bit trickier, and only works if the member function returns self
, but nonetheless would be nice for workflows which naturally rely on R6's method chaining.
Context
I am the author of the rClr (R - .NET interop) package and considering R6 as a way to expose .NET objects via reference classes. I started using the R reference classes some months ago but bumped into several issues. R6 may be a better option.
Feature request
One important feature I'd think is a boon to user experience is code completion after the $ separator on object members. I think these are features of the Rcpp, rJava and rJavax packages, using utils::.DollarNames and related facilities. I am not familiar with the details.
I have forked R6, and may consider implementing these features, unless: