This doesn't seem to have anything to do with reference classes but
rather is deep in the evaluator. At least when set up in the simple
form of your example, the $<- method is never called.
For example:
Foo <- setRefClass("Foo")
foo <- Foo$new()
find("$<-")
[1] "package:base"
debug(base:
I've found that reference class objects tend to behave like plain old
environments wrt field access, unless a method on e.g. $<- is explicitly
defined.
Here is a code snippet:
library(methods)
Foo <- setRefClass("Foo")
foo <- Foo$new()
foo$a <- 2 # why does this succeed? not a valid field!
## se