A problem with callNextMethod, which is caching an inherited method as 
if it was not inherited, causing confusion on the next search.  Should 
be fairly easy to fix, but may be a while before I get time to do so.

By the way, I hope your simplified example does not reflect what happens 
in the actual one.
   callNextMethod(.Object)
throws away all the ... arguments to new(), which rather defeats the 
purpose of having initialize() methods.  Generally, callNextMethod() 
should get no arguments or all the arguments it needs, including ...
See ?callNextMethod


Herve Pages wrote:
> Hi again,
>
> This happens with R-2.4.0 and R-devel.
>
> Cheers,
> H.
>
> Herve Pages wrote:
>   
>> 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) [EMAIL PROTECTED] <- "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.
>>
>> ______________________________________________
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>>     
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>   

        [[alternative HTML version deleted]]

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

Reply via email to