[Rd] Overloading methods in R

Martin Maechler maechler at stat.math.ethz.ch
Wed Apr 20 19:42:41 CEST 2005


>>>>> "Ali" == Ali - <saveez at hotmail.com>
>>>>>     on Wed, 20 Apr 2005 15:45:09 +0000 writes:

    Ali> Thanks a lot Tony. I am trying to apply the overloading
    Ali> to the methods created by R.oo package and,
    Ali> unfortunately, R.oo uses S3-style classes; so I cannot
    Ali> use the features of S4 methods as you described. On the
    Ali> other hand, I caouldn't find a decent OO package which
    Ali> is based on S4 AND comes with the official release of
    Ali> R.

Ali, maybe we R-core members are not decent enough.
But we strongly believe that we don't want to advocate yet
another object system additionally to the S3 and S4 one,
and several of us have given talks and classes, even written
books on how to do "decent" object oriented programming 
`just' with the S3 and/or S4 object system.

No need of additional "oo" in our eyes.
Your main problem is that you assume what "oo" means {which may
well be true} but *additionally* you also assume that OO has to
be done in the same way you know it from Python, C++, or Java..

Since you are new, please try to learn the S4 way,
where methods belong to (generic) functions more than
to classes in some way, particularly if you compare with other
OO systems where methods belong entirely to classes.
This is NOT true for R (and S-plus) and we don't want this to
change {and yes, we do know about C++, Python, Java,... and
their way to do OO}.

Please also read in more details the good advice given by Tony
Plate and Sean Davis.

Martin Maechler,
ETH Zurich



More information about the R-devel mailing list