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 lock environment for DefaultPlotConfiguration class #1030

Closed
wants to merge 1 commit into from

Conversation

IndrajeetPatil
Copy link
Member

Otherwise, if we try to extend this class further (like here), we get the following error:

"cannot add bindings to a locked environment"

[L] signifies that the environment is locked.

library(R6)

Person1 <- R6Class("Person")
rlang::env_print(Person1$new())
#> <environment: 0x000000001967f5b8> [L]
#> Parent: <environment: empty>
#> Class: Person, R6
#> Bindings:
#> * .__enclos_env__: <env>
#> * clone: <fn> [L]

Person2 <- R6Class("Person", lock_objects = FALSE)
rlang::env_print(Person2$new())
#> <environment: 0x000000002026b370>
#> Parent: <environment: empty>
#> Class: Person, R6
#> Bindings:
#> * .__enclos_env__: <env>
#> * clone: <fn> [L]

Created on 2022-07-19 by the reprex package (v2.0.1.9000)

@IndrajeetPatil IndrajeetPatil requested a review from PavelBal July 19, 2022 10:02
@IndrajeetPatil IndrajeetPatil marked this pull request as draft July 19, 2022 10:20
@IndrajeetPatil IndrajeetPatil deleted the unlock_env_default branch July 19, 2022 10:22
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

Successfully merging this pull request may close these issues.

1 participant