> In my opinion the reason for the behavior lies in the specific multiple 
> inheritance structure between AB, B and A.

So what if we don't make such a weird inheritance structure, and
instead have A and B inherit from a common parent:

setClass("A", contains = "list")
setClass("B", contains = "list")
setClass("AB", contains = c("A", "B"))

setGeneric("f", function(x, y) standardGeneric("f"))
setMethod("f", signature("A", "A"), function(x, y) "A-A")
setMethod("f", signature("B", "B"), function(x, y) "B-B")

ab <- new("AB")
f(ab, ab)

Why isn't there a warning about ambiguous dispatch?

Hadley

-- 
Chief Scientist, RStudio
http://had.co.nz/

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to