[Rd] S4 initialize or "generating function"
sfalcon at fhcrc.org
Wed Jan 31 18:39:57 CET 2007
Thomas Petzoldt <Thomas.Petzoldt at tu-dresden.de> writes:
> Your example works but one can not arbitrarily mix slots, other named
> arguments and the default callNextMethod(). The documentation states:
> "... Data to include in the new object. Named arguments correspond
> to slots in the class definition."
And this is where I start to get bent out of shape with what
"initialize" wants to assume about how _my_ objects should get
> In such cases one has to add the arguments to callNextMethod(y=1)
Yes. There are other cases where you will only get the correct
behavior if you explicitly list args to callNextMethod (I believe that
one case is where your generic has default args). I guess in my view,
constructors are just another method and so one shouldn't expect them
to align so tightly for related classes.
More information about the R-devel