[Rd] callNextMethod()

John Marsland john.marsland at wmgfunds.com
Wed Apr 20 19:33:03 CEST 2005


I have built a sequence of eight S4 classes, each of which inherits 
from the previous one but adds extra slots.

I have a corresponding generic function for which I have described 
methods for each of these classes in a signature with one other 
variable. There are also some ad hoc variable outside the signature 
which have different default values for each class.

Each method calls callNextMethod() to populate the slots which it has 
in common with the previous class and then some additional code to 
populate the new slots in the class.

Before writing each new method the selectMethod() function correctly 
identifies the method which I would like to call from the 
callNextMethod() function. But after 3-4 levels of nesting the method 
seem unable to identify the correct next method and returns nothing but 
continues without error.

I'm sorry, but I couldn't reproduce the problem with a simple example. 
But after countless hours of debug, a thorough reading of the Green 
Book and various attempts with the trace() function - this just drops 
the trace within callNextMethod(), again without error - , I have 
exhausted all my ideas for what is wrong.

All I can think is there might be a problem in callNextMethod(), making 
it inconsistent with selectMethod(). It also not clear to me how 
default values are passed through to the next method.

Is there a recommended debug process for this sort of problem? Is there 
a way call a specific method with a defined signature from within the 
new method definition?

Regards,

John Marsland



More information about the R-devel mailing list