[Rd] Ref classes initFields has incorrect environment?
Hadley Wickham
h.wickham at gmail.com
Thu Mar 28 19:40:03 CET 2013
As suggested by the following code:
A <- setRefClass("A", fields = list(x = "logical"),
methods = list(initialize = function(...) {
x <<- FALSE
initFields(...)
}))
A$new()
# Works as expected
quote <- as.character
A$new()
# Error in function (value) :
# invalid replacement for field ‘x’, should be from class “logical”
or a subclass (was class “character”)
I get the same error in:
* R version 2.15.2 (2012-10-26)
* R version 2.15.3 (2013-03-01)
* R Under development (unstable) (2013-03-28 r62432)
Hadley
--
Chief Scientist, RStudio
http://had.co.nz/
More information about the R-devel
mailing list