From janko.thyson.rstuff at googlemail.com  Fri May 27 15:13:29 2011
From: janko.thyson.rstuff at googlemail.com (Janko Thyson)
Date: Fri, 27 May 2011 15:13:29 +0200
Subject: [Rd] Reference Classes/S4 Classes: can method dispatch check
 superclasses BEFORE resorting to method for "ANY"?
Message-ID: <4DDFA379.10904@googlemail.com>

Dear list,

is it possible that method dispatch checks for superclasses/virtual 
classes before checking "ANY"?

I'd like to build a generic initialization method for all my Reference 
Class (say "MyDataFrame") objects by having them inherit from class, say 
"MyRefClassVirtual" (which would have to be a virtual S4 class; there 
are no virtual Reference Classes, are there?)

The problem is that 'getRefClass("MyDataFrame")$new' calls (I think) the 
method that was written for "ANY". Thus even though I write a explicit 
initialize method for class "MyRefClassVirtual" which I should be called 
for "MyDataFrame" as it inherits from this class, this method will never 
be called because "ANY beats anything else".

So, I think I'd like to tell the method somehow to check for 
superclass/virtual classes *before* resorting to "ANY".

Is that possible?

Regards,
Janko



[Rd] Reference Classes/S4 Classes: can method dispatch check superclasses BEFORE resorting to method for "ANY"?
Janko Thyson