Skip to content
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

For non-portable objects, inherited methods have extra reference to .__active__ #216

Open
wch opened this issue Oct 20, 2020 · 1 comment

Comments

@wch
Copy link
Member

wch commented Oct 20, 2020

In this example, there are two references to .__active__, but there should only be one.

library(R6)
A <- R6Class("A",
  portable = FALSE,
  public = list(
    getx = function() self$x,
    x = 1
  ),
  active = list(
    x2 = function() 2 * self$x
  )
)

B <- R6Class("B",
  portable = FALSE,
  inherit = A
)


b <- B$new()

library(pryr)
#> Registered S3 method overwritten by 'pryr':
#>   method      from
#>   print.bytes Rcpp

rls(b$getx)
#> [[1]]
#> [1] ".__active__"
#> 
#> [[2]]
#> [1] ".__active__"     ".__enclos_env__" "clone"           "getx"           
#> [5] "self"            "super"           "x"               "x2"             
#> 
#> [[3]]
#> [1] "A" "b" "B"
@wch
Copy link
Member Author

wch commented Oct 20, 2020

Hm, now that I've experimented with this, I think it might be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant