[R] "use of NULL environment is defunct" when trying to lock a reference class
Ivan Krylov
krylov@r00t @ending from gm@il@com
Mon Aug 27 18:25:08 CEST 2018
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 using field, current using className, TRUE, environment(current)) :
use of NULL environment is defunct
By looking at traceback() and source of methods:::.lockRefFields,
I see that environment(zzz using generator$def using 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.
More information about the R-help
mailing list