Hi!

I'm trying to create a persistent memoising class with a destructor and
an option to evaluate cache misses in parallel. I want to lock all
its fields because it doesn't make sense to change them after the
filename, the environment object and the function are set in the
object. (I'm not sure whether I should lock the environment field I use
as the hash, though.)

The problem is, I can't figure out how to use class$lock(...) properly:

> test.class <- setRefClass("test", fields=c("field"))
> test.class$lock("field")
Error in .makeDefaultBinding(current@field, current@className, TRUE, 
environment(current)) :
  use of NULL environment is defunct

By looking at traceback() and source of methods:::.lockRefFields,
I see that environment(zzz@generator$def@fieldPrototypes[["field"]])
is, indeed, NULL.

I'm using R version 3.3.3 (2017-03-06),  version$`svn rev` is "72310".

What am I doing wring?

-- 
Best regards,
Ivan

P.S. Please Cc me in your replies to the list, if possible.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to