search for: selfenv

Displaying 4 results from an estimated 4 matches for "selfenv".

Did you mean: selene
2012 Aug 05
1
setting invalid fields on reference classes sometimes allowed
..."b", value)}) foo$b <- 3 At first, we can set the non-existent field "a" without any error (I don't think this is the intended behavior). Then we set a silly override on $<- and things start to behave as expected: Error in envRefSetField(x, what, refObjectClass(x), selfEnv, value) : "b" is not a field in class "Foo" What am I doing wrong? Thanks, Michael [[alternative HTML version deleted]]
2013 Apr 30
1
trace with reference class
Hi The final line of the example in ?setRefClass induces an error: > ## debugging all objects from class mEdit in method $undo() > mEdit$trace(undo, browser) Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : 'undo' is not a valid field or method name for reference class "refGeneratorSlot" $trace tries to embed the trace in the generator object (instead of the generated object). Has this functionality been removed? best, kohske -- Kohske Takahashi <takahashi.kohske at gmail...
2012 Feb 21
1
Private Variables in R5-Classes possible?
..._value", envir=.self at .xData, inherits = F)) } else{ return(NULL) } } assign("secret_value", value=value, , envir=.self at .xData) } ) ) > t <- test$new() > t$secret the function was called NULL > t$secret_value Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : "secret_value" is not a valid field or method name for reference class ?test? > t$secret <- "Blub" the function was called > t$secret_value [1] "Blub"
2014 Mar 03
1
reference classes, LAZY_DUPLICATE_OK, and external pointers
...o the external pointer, a reference/lazy copy is made. (xpp$theta itself is read-only, so I can't do the assignment that way) I can hack around this in a very ugly way by doing a trivial modification when assigning inside the copy method: assign("theta",get("theta",envir=selfEnv)+0, envir=vEnv) ... but (a) this is very ugly and (b) it seems very unsafe -- as R gets smarter it should start to recognize trivial changes like x+0 and x*1 and *not* copy in these cases ... Method details: ## from R/AllClass.R, merPredD RC definition ptr = function() { 'ret...