Skip to content
Prev 26971 / 63458 Next

another S4 question ...

Here is my current understanding: this area has changed a bit recently.

S4 generics of the same name in different packages are regarded as 
different.  If you define a generic show() in your package, it will not 
have any of the methods defined on methods::show, and likely mask the 
latter. So users will be asking 'where have all my show() methods gone?'.

Then there are the perennial scoping problems.  If both your package and 
methods have generics for show(), which is found depends on where you are 
looking from: you cannot in general 'override' an existing function in 
R's scoping system.  For example, any function in another package that 
imports 'methods' will find methods:::show and not your version.

This is a generic problem: e.g. both packages stats4 and lme4 have 
generics for BIC, and you will get the methods for one or the other 
depending on which is found first in the current scope.
On Mon, 10 Dec 2007, Ben Bolker wrote:

            
You can define methods on print(), if you want those arguments.