[Rd] 3 minor issues with getClass 'resolve.msg' arg

Martin Maechler maechler at stat.math.ethz.ch
Mon Jul 11 12:30:26 CEST 2016


>>>>> Hervé Pagès <hpages at fredhutch.org>
>>>>>     on Sun, 26 Jun 2016 13:21:00 -0700 writes:

    > Hi,
    > It turns out that two packages (1 Bioconductor, 1 CRAN) define an
    > S4 class called "Annotated":

    > library(S4Vectors)  # see (*) at bottom for how to install
    > library(RNeXML)

    > 1st issue
    > ---------

    > getClass() issues the same warning twice:

    > tmp <- getClass("Annotated")
    > Found more than one class "Annotated" in cache; using the first, from 
    > namespace 'S4Vectors'
    > Found more than one class "Annotated" in cache; using the first, from 
    > namespace 'S4Vectors'

    > 2nd issue
    > ---------

    > It would be very helpful if the warning message was giving the name of
    > the other package. I was in a session with 50+ packages attached or
    > loaded via a namespace when I saw the warning. Took me a while to
    > identify the other package, which I finally managed to do with:

    > names(.Call(methods:::C_R_getClassFromCache, "Annotated", 
    > methods:::.classTable))

    > 3rd issue
    > ---------

    > Calling getClass() with 'resolve.msg=FALSE' only removes one of the 2
    > warnings:

    >> tmp <- getClass("Annotated", resolve.msg=FALSE)
    > Found more than one class "Annotated" in cache; using the first, from 
    > namespace 'S4Vectors'


Indeed, R-core had found this to be buggy ourselves, and changes
happened then to clean up this behavior; specifically it was

------------------------------------------------------------------------
r70554 | lawrence | 2016-04-27 06:05:07 +0200 (Wed, 27 Apr 2016)

better resolve multiple hits in the class cache
------------------------------------------------------------------------

Because the changes would have potential effects that were not
so easy to predict, and I think it *does* entail changed
*behavior* (not just messages) in some cases, the change have not
been ported to R 3.3.x patched, but remained in "R-devel".
Here is the NEWS entry (2nd entry of 'BUG FIXES) :

o When a class name matches multiple classes in the cache,
  perform a dynamic search in order to obey namespace
  imports. This should eliminate annoying messages about multiple
  hits in the class cache. Also, pass along the package from the
  ClassExtends object when looking up superclasses in the cache.

    > Thanks,
    > H.

You are welcome,
Martin


    > (*) Install S4Vectors with:

    > source("https://bioconductor.org/biocLite.R")
    > biocLite("S4Vectors")

    > -- 
    > Hervé Pagès

    > Program in Computational Biology
    > Division of Public Health Sciences
    > Fred Hutchinson Cancer Research Center
    > 1100 Fairview Ave. N, M1-B514
    > P.O. Box 19024
    > Seattle, WA 98109-1024

    > E-mail: hpages at fredhutch.org
    > Phone:  (206) 667-5791
    > Fax:    (206) 667-1319

    > ______________________________________________
    > R-devel at r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list