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

"lock" parameter is being ignored? #52

Closed
daattali opened this issue Mar 23, 2015 · 1 comment
Closed

"lock" parameter is being ignored? #52

daattali opened this issue Mar 23, 2015 · 1 comment

Comments

@daattali
Copy link

@daattali daattali commented Mar 23, 2015

From my understanding of the documentation, if a class is defined with lock = TRUE (which is the default), then adding new members should not be allowed. But I'm not seeing this restriction happening in practice.

Test <- R6::R6Class(
  "test",
  lock = TRUE,

  public = list(
    anything = function(){}
  )
)

Test$set("public", "setName", function(s) s)
> names(Test$public_methods)
[1] "anything" "setName" 

Maybe I'm misinterpreting what lock is doing.


R 3.1.3, R6 2.0.1

@wch
Copy link
Member

@wch wch commented Apr 14, 2015

The lock argument actually means that the objects (not the generator) can't have new fields added to them. But it would be useful to have a lockClass argument as well.

Loading

@wch wch closed this in eabc68d Jun 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants