[Rd] Same class name, different package

Martin Maechler maechler at stat.math.ethz.ch
Mon Jul 25 09:07:30 CEST 2011


>>>>> John Chambers <jmc at r-project.org>
>>>>>     on Sun, 24 Jul 2011 14:58:23 -0700 writes:

    > 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

I haven't yet looked into the many situations that are "out
there" for CRAN and Bioconductor packages and am just speaking
from my own S4-using perspective:

I think 

  ImportClassesFrom(...)

should be much more widely used, in order to diminish such class
"conflicts".  
Wherever the new code produces warnings (does it?) about
duplicate class names, it would be good to "advertize" the 
ImportClassesFrom()   clause for those cases where the two
class definitions look to be identical.

Martin


    > 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



More information about the R-devel mailing list