Consider the following lines:
r <- diag(3)
x <- rep(1,3)
setMethod("backsolve", "M", function(r,x,...) r)
The last call produces an error, related to the generic definition. IMHO, a default argument k=ncol(r) is missing:
setGeneric("backsolve", function(r, x, k = ncol(r), upper.tri = TRUE,
transpose = FALSE, ...) standardGeneric("backsolve"),
useAsDefault = function(r, x, k = ncol(r), upper.tri = TRUE,
transpose = FALSE, ...) base::backsolve(r, x, k = k,
upper.tri = upper.tri, transpose = transpose, ...),
signature = c("r", "x"))
PS: is there a reason, why no generic for forwardsolve is defined.
R version 2.15.0 (2012-03-30)
Platform: i686-pc-linux-gnu (32-bit)
 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
 LC_PAPER=C LC_NAME=C
 LC_ADDRESS=C LC_TELEPHONE=C
 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
 stats graphics grDevices utils datasets methods base
Fixed in r-devel and 2.15.0 patched. Thanks.
Re. forwardsolve(). Actually, the question is more why we bothered to have an implicit generic with different signature for backsolve(). Long ago, it was thought to be significantly inefficient to have extra arguments in the signature. Not really true, and although it's hard to see how dispatching on anything other than r & x could make sense, it's not really worth an exception.
More to the point, the whole code for implicit generics is old-fashioned given the more natural behavior of setGeneric(), and should use the non-generic version directly.