From hpages at fhcrc.org  Wed Mar  4 04:19:04 2009
From: hpages at fhcrc.org (hpages at fhcrc.org)
Date: Tue, 03 Mar 2009 19:19:04 -0800
Subject: [Rd] callNextMethod() doesn't pass down arguments
Message-ID: <20090303191904.1p825oo8qgw00s48@webmail.fhcrc.org>

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.



[Rd] callNextMethod() doesn't pass down arguments
hpages at fhcrc.org