[Rd] Same class name, different package

John Chambers jmc at r-project.org
Sun Jul 24 23:58:23 CEST 2011


A point that has come up a couple of times with the new test is that two 
classes from two packages may be "the same class".  Should that turn on 
duplicate classes?

One situation where the answer seems to be No is when the two classes 
are identical declarations of S3 classes, via setOldClass().

A recent update (rev. 56492) tries to check for equivalent classes, with 
some special leeway for that case, and does not turn on the  duplicate 
class flag.  It's not clear what is really needed or wanted in all 
circumstances, so further experience will be helpful.

If duplicate classes do exist, a utility findDuplicateClasses(details = 
FALSE) will give the names of the duplicated classes.  It's not yet 
exported so you need to call methods:::findDuplicateClasses()

John


On 7/21/11 10:29 AM, John Chambers wrote:
> In principle, two separately developed packages could use the same
> class name, and a user could then attach both and attempt to use
> methods for both classes.
>
> That has never worked, but some changes have been added to r-devel to
> handle this case.  The changes involve extending the "signature" class
> to include package information.  For compatibility, packages will need
> to be re-installed from a version of R labelled 56466 or later,
> although an attempt is made to fill in missing information.
>
> John
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list