John Chambers
2009-Apr-26 19:58 UTC
[Rd] Some extensions to class inheritance and method selection
Changes were committed today to the r-devel version of R to make S4 and S3 classes (and abnormal object types such as "environment") work together more consistently. Basically, S4 classes can now contain any S3 class or object type, and should now inherit S3 methods for these. Also, the main practical problem with defining S3 methods for other S4 classes (namely, that S4 inheritance was not recognized) has been fixed, to the extent possible. See ?Methods (especially the section on S3 methods). For details (there are quite a few) see the paper referenced there, http://stat.stanford.edu/~jmc4/classInheritance.pdf Since these changes arguably fix design flaws, I would like to see them in 2.9.1, so please test them out. For the moment, they are only in the r-devel version. There can be changes to current behavior. For example, I found one regression test for S4 methods that only worked because an apparent S3 method, sort.list, was NOT inherited by an S4 class that contained "list". John
Roger Bivand
2009-Apr-29 11:54 UTC
[Rd] Some extensions to class inheritance and method selection
In released 2.9.0, we have been seeing warnings when installing sp, for example: Warning in .checkS3forClass(ClassDef at className, where, names(exts)) : Some of the superclasses in the definition of class "SpatialPoints" have apparent S3 methods. DANGER: the new class will not inherit these methods. Complain to the author of the superclass definitions. The apparent methods are "plot.Spatial", "summary.Spatial" Running R CMD check sp (or installing from CRAN) on 2.10.0 (2009-04-29 r48433) does not generate any such warnings. For us, it would be helpful if the extensions could be patched into 2.9.1 (although no user has complained, curiously enough). Roger John Chambers-2 wrote:> > Changes were committed today to the r-devel version of R to make S4 and > S3 classes (and abnormal object types such as "environment") work > together more consistently. > > Basically, S4 classes can now contain any S3 class or object type, and > should now inherit S3 methods for these. Also, the main practical > problem with defining S3 methods for other S4 classes (namely, that S4 > inheritance was not recognized) has been fixed, to the extent possible. > > See ?Methods (especially the section on S3 methods). For details (there > are quite a few) see the paper referenced there, > http://stat.stanford.edu/~jmc4/classInheritance.pdf > > Since these changes arguably fix design flaws, I would like to see them > in 2.9.1, so please test them out. For the moment, they are only in the > r-devel version. > > There can be changes to current behavior. For example, I found one > regression test for S4 methods that only worked because an apparent S3 > method, sort.list, was NOT inherited by an S4 class that contained "list". > > John > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >-- View this message in context: http://www.nabble.com/Some-extensions-to-class-inheritance-and-method-selection-tp23245983p23295792.html Sent from the R devel mailing list archive at Nabble.com.
Stavros Macrakis
2009-Apr-29 14:29 UTC
[Rd] Some extensions to class inheritance and method selection
These look like important improvements. As a relative newcomer to the R community, I'm not sure I understand what the procedures are for such changes. In particular, does the fact that the changes were committed to R-devel mean that the changes have already been reviewed and approved by R Core? Are R Core's discussions / deliberations archived somewhere? What is the role of the larger R community in reviewing and approving changes like this? How is documentation handled? Who is responsible for developing and maintaining a definitive reference manual (not just man pages) which includes all the cumulative changes and describes them comprehensively and in black-box way (not referring to history and implementation details)? Thanks, -s On Sun, Apr 26, 2009 at 3:58 PM, John Chambers <jmc@r-project.org> wrote:> Changes were committed today to the r-devel version of R to make S4 and S3 > classes (and abnormal object types such as "environment") work together more > consistently. > > Basically, S4 classes can now contain any S3 class or object type, and > should now inherit S3 methods for these. Also, the main practical problem > with defining S3 methods for other S4 classes (namely, that S4 inheritance > was not recognized) has been fixed, to the extent possible. > > See ?Methods (especially the section on S3 methods). For details (there > are quite a few) see the paper referenced there, > http://stat.stanford.edu/~jmc4/classInheritance.pdf<http://stat.stanford.edu/%7Ejmc4/classInheritance.pdf> > > Since these changes arguably fix design flaws, I would like to see them in > 2.9.1, so please test them out. For the moment, they are only in the > r-devel version. > > There can be changes to current behavior. For example, I found one > regression test for S4 methods that only worked because an apparent S3 > method, sort.list, was NOT inherited by an S4 class that contained "list". > > John > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]