Skip to content
Prev 31625 / 63424 Next

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())
[1] TRUE
[1] TRUE

setMethod("[", "A",
     function(x, i, j, ..., drop=TRUE) return(drop))
setMethod("[", "B",
     function(x, i, j, ..., drop=TRUE) callNextMethod())
[1] TRUE
[1] TRUE

I tried this with R 2.8.0 and 2.9.0 (r47727).

Cheers,
H.