Hi Martin,

Thanks for the heads up and thanks Michael for making this change.

FWIW I just tried this with R-devel and indeed it seems to be doing
a much better job at handling multiple hits in the cache class. In
particular the Annotated class defined in the RNeXML package doesn't
get in the way anymore because it's not exported. Perfect!

Cheers,
H.

On 07/11/2016 03:30 AM, Martin Maechler wrote:
Hervé Pagès <hpa...@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: hpa...@fredhutch.org
     > Phone:  (206) 667-5791
     > Fax:    (206) 667-1319

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


--
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: hpa...@fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

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

Reply via email to