[Rd] callNextMethod() doesn't pass down arguments
hpages at fhcrc.org
hpages at fhcrc.org
Wed Mar 4 04:19:04 CET 2009
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.
More information about the R-devel
mailing list