r-lib / R6

Encapsulated object-oriented programming for R
https://R6.r-lib.org
Other
403 stars 56 forks source link

Don't rely on buggy as.list.environment behavior #192

Closed wch closed 4 years ago

wch commented 4 years ago

In R-devel, with the environment var _R_ENV2LIST_BUGFIX_=true, the as.list.environment() function no longer gives the function associated with an active binding; it calls the function and gives the returned value instead. This will become the default (probably) in R 4.0.

This buggy behavior was used when cloning an R6 object with active bindings. This PR fixes the issue by storing the functions for active bindings separately, if the object is cloneable.