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

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

Merged
merged 3 commits into from Oct 18, 2019
Merged

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

merged 3 commits into from Oct 18, 2019

Conversation

@wch
Copy link
Member

@wch wch commented Oct 17, 2019

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.

wch added 3 commits Oct 17, 2019
In R-devel, as.list.environment no longer returns the function for an active
binding; instead it returns the value from executing the function. When the
object is cloned, we need to get the function definition, but there's now no
way to get it from the environment, so we have to store a copy of it.
@wch wch requested a review from gaborcsardi as a code owner Oct 17, 2019
@wch wch merged commit 6288d96 into master Oct 18, 2019
@wch wch deleted the fix-active branch Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.