From hpages at fhcrc.org  Fri Oct 27 01:20:33 2006
From: hpages at fhcrc.org (Herve Pages)
Date: Thu, 26 Oct 2006 16:20:33 -0700
Subject: [Rd] Pb with .findInheritedMethods
Message-ID: <454142C1.9030809@fhcrc.org>

Hi again,


Here is a very simplified version of a class hierarchy
defined in the Biobase package (Bioconductor). I post
here because this seems to be an S4 related problem:

    setClass("A", representation(name="character"))
    setMethod("initialize", "A", function(.Object) {.Object at name <- "I'm
    an A"; .Object})

    setClass("Ab", contains="A")
    setMethod("initialize", "Ab", function(.Object) callNextMethod(.Object))

    setClass("Abc", contains="Ab")

    setClass("Abcd", contains = c("Abc"))

Now if I do:

    tmp1 <- new("Abc")
    tmp2 <- new("Abcd")

I get the following warning:

    Warning message:
    Ambiguous method selection for "initialize", target "Abcd" (the
    first of the signatures shown will be used)
        Abc
        Ab
     in: .findInheritedMethods(classes, fdef, mtable)

I don't really understand why .findInheritedMethods is
complaining here...
And if I don't do 'tmp1 <- new("Abc")' before I
do 'tmp2 <- new("Abcd")', then I don't get the warning
anymore!

Does anybody have an explanation for this?


Thanks,
H.




[Rd] Pb with .findInheritedMethods
Herve Pages