2

I want to extend a generator object, but all the R help files have on this subject is:

Note that if one wanted to extend the reference class generator capability with a subclass, this should be done by subclassing refGeneratorSlot, not refObjectGenerator.

OK, but how do you actually do this? So I've tried:

MyGenerator <- setRefClass("MyGenerator",
    contains = "refGeneratorSlot",
    methods = list(
        new = function(...) {
            message("Hello, I'm being instantiated now!")
            callSuper(...)
        }
    )
)

but now what? How do I actually use this in conjunction with my class definitions that use setRefClass()?

mchen
  • 9,808
  • 17
  • 72
  • 125
  • 1
    Since you have a lot of tough questions about reference classes, it might be wise to contact John Chambers. He hangs out a lot on the r-devel mailing list, and is usually happy to answer questions via email (jmc at r-project dot org). – Richie Cotton Jan 23 '14 at 12:19
  • I think the answer to [this question][1] is what you want. [1]: http://stackoverflow.com/questions/21243359/modify-s3-object-without-returning-it/ – Carlos Cinelli Jan 23 '14 at 15:43

0 Answers0