Hi,

I met a problem when invoking callNextMethod within a method associated with a generic function taking ... as an argument.

Here is the code

setClass("Aparent",representation(x="numeric",y="numeric"))
setClass("Achild",contains="Aparent")

setGeneric("do",def=function(a,...) standardGeneric("do"))
setMethod("do",signature(a="Aparent"),
          function(a,msg) {
            print("do Aparent")
          })
setMethod("do",signature(a="Achild"),
          function(a,msg)  {
            print("do Achild")
            callNextMethod()
          })

myA <- new("Achild")
buf <- do(a=myA)               # works
buf <- do(a=myA,msg="bonjour") # error

The last call yields the following error message:

Error in callNextMethod() :
in processing 'callNextMethod', found a '...' in the matched call, but no corresponding '...' argument

which I do not understand. Replacing "..." by "msg" in setGeneric makes it work. But I don't like this limitation so much (unless I understand it).

Regards.

Kien

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to