Re: [Rd] Inheritance before ANY...

From: Martin Maechler <>
Date: Wed, 10 Jun 2009 10:35:30 +0200

>>>>> "CG" == Christophe Genolini <>
>>>>> on Tue, 09 Jun 2009 22:11:51 +0200 writes:

    CG> Hi all,
    CG> I am programming using S4. I define two classes, "B" is inheriting from 
    CG> "A". Apparently (at least since version 2.9.0 ?), when the correct 
    CG> signature is not find,
    CG> R prefers to chose a signature in the ancestor BEFORE a signature in the 
    CG> class. This is very strange to me...

    CG> If I define plot for ("A",missing) and ("B",ANY), calling 
    CG> plot("B",missing), I would expect R to chose plot("B",ANY) before     CG> plot("A",missing)
    CG> ------------------ (translate from french) --------
    CG> Note : method with signature "A#missing" chose for function "plot",
    CG> signature cible "B#missing".
    CG> "B#ANY" could also be compatible

Yes, method dispatch had indirectly been greatly improved in 2.9.0, as the elimination of duplicate superclasses and a consistent (superclass) ordering was introduced.

Look at

and skip to its references (simply "sr" in ESS), finding

     Chambers, John M.(2009) _Developments in Class Inheritance and
     Method Selection_ <URL:>.

which is very recommended, and, BTW, as I just notice, has been updated in the very last few days,
judging from my earlier reading; the updates include new features of class definition / method dispatch in the situation where S3 and S4 are intermingled.

Martin Maechler, ETH Zurich mailing list Received on Wed 10 Jun 2009 - 08:43:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 10 Jun 2009 - 14:35:46 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive