[Rd] Pb with .findInheritedMethods

Seth Falcon sfalcon at fhcrc.org
Sun Oct 29 02:13:57 CET 2006


John Chambers <jmc at r-project.org> writes:
> As I mentioned, this relates to writing methods for initialize().
> Imagine someone else extends the class "Ab", for which you wrote a
> method.  If they add slots to their class and you do not pass down ...
> to callNextMethod(), then you have blocked users from setting values
> for those slots in calls to new(), since the ... argument is thrown
> away by your method.

If you have written an initialize method, then it is likely because
you want to do something other than just fill slots.  A subclass will
most likely need to define its own initialize method and in this case,
I'm not sure passing ... will matter.

> The other aspect to this is that the last specialized method in your
> chain of class definitions should end up with: callNextMethod(.Object,
> ...)  Then the default initialize() method will set values for named
> slots.

Unless that isn't the behavior one desires (and I would claim this is
a rather common situation).  As part of the user interface to the
class, the developer may want to decouple the intitialization
interface from specific slot names.


+ seth




More information about the R-devel mailing list