Displaying 1 result from an estimated 1 matches for "defaultrc".
Did you mean:
defaultbc
2014 Mar 03
1
reference classes, LAZY_DUPLICATE_OK, and external pointers
...nology.
TL;DR Is there an elegant way to force non-lazy/deep copying in our
case? Is anyone else using reference classes with a field that is an
external pointer?
This is how copying of reference classes works in a normal
situation:
library(data.table) ## for address() function
setRefClass("defaultRC",fields="theta")
d1 <- new("defaultRC")
d1$theta <- 1
address(d1$theta) ## "0xbbbbb70"
d2 <- d1$copy()
address(d2$theta) ## same as above
d2$theta <- 2
address(d2$theta) ## now modified, by magic
d1$theta ## unmodified
The extra complication in o...