Re: [Rd] setting invalid fields on reference classes sometimes allowed

2012-08-05 Thread John Chambers
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:

[Rd] setting invalid fields on reference classes sometimes allowed

2012-08-05 Thread Michael Lawrence
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