hpages at fhcrc.org
2009-Mar-04 03:19 UTC
[Rd] callNextMethod() doesn't pass down arguments
Hi,
According to its man page, callNextMethod() (called with
no argument) should call the next method "with the arguments
to the current method passed down to the next method".
But, for the "[[" and "[" generics (primitives), the
argument
after the dots doesn't seem to be passed down:
setClass("A", representation(thing="ANY"))
setClass("B", contains="A")
setMethod("[[", "A",
function(x, i, j, ..., exact=TRUE) return(exact))
setMethod("[[", "B",
function(x, i, j, ..., exact=TRUE) callNextMethod())
> b <- new("B")
> b[[3]]
[1] TRUE> b[[3, exact=FALSE]]
[1] TRUE
setMethod("[", "A",
function(x, i, j, ..., drop=TRUE) return(drop))
setMethod("[", "B",
function(x, i, j, ..., drop=TRUE) callNextMethod())
> b[3]
[1] TRUE> b[3, drop=FALSE]
[1] TRUE
I tried this with R 2.8.0 and 2.9.0 (r47727).
Cheers,
H.