On Mon, 23 May 2005, Ross Boylan wrote:

On Mon, 2005-05-23 at 14:41 -0700, Ross Boylan wrote:
....

Finally, I'm a bit concerned that one article mentioned that S4
inheritance, in practice, is used mostly for data, not methods (Thomas
Lumley, R News 4(1), June 2004: p. 36).  Am I going down a road I
shouldn't travel?

Hmm, maybe I just found out.  If B is an S4 subclass of A (aka extends
A), how does B's method foo invoke A's foo?


You may be looking for callNextMethod, or foo(as(object, "A")).

The comment about inheritance in my R News article has nothing to do with S3 vs S4. It is just that extensions of data structures typically happen by specialisation (for which inheritance is appropriate) whereas models are typically extended by generalisation (for which inheritance isn't appropriate).

The only relevance to the S3 vs S4 discussion is that it provides an explanation for the lack of appreciation of S4. Since most statisticians don't use inheritance when programming they don't see the benefit in a system that gets inheritance right.

        -thomas

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to