[Rd] library(methods): setMethod with "ANY" fails. (PR#1317)

hb@maths.lth.se hb@maths.lth.se
Tue, 19 Feb 2002 01:22:59 +0100 (MET)

Full_Name: Henrik Bengtsson
Version: R v1.4.1
OS: WinMe
Submission from: (NULL) (

Doing the following

setGeneric("foo", function(x) standardGeneric("foo"))
setMethod("foo", "ANY", function(x) cat(x))

fails with

Error in while (value[n] == "ANY") n <- n - 1 : 
        missing value where logical needed

It looks like the line

  while (value[n] == "ANY") n <- n - 1

in the source for matchSignature() should be

  while (n > 0 && value[n] == "ANY") n <- n - 1

FYI: I tried my suggested modification at it seems to work.

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch