There seems to be a bug arising when using multiple S4 generics with "..."
as the signature.

The following code works as expected:

##############################################################

> setGeneric("rbind", function(..., deparse.level=1)
standardGeneric("rbind"),
+            signature = "...")
Creating a generic for "rbind" in package  ".GlobalEnv"
    (the supplied definition differs from and overrides the implicit generic
in package "base": Signatures differ:  (...), (deparse.level))
[1] "rbind"
> rbind(1)
     [,1]
[1,]    1
> rbind
standardGeneric for "rbind" defined from package ".GlobalEnv"

function (..., deparse.level = 1)
standardGeneric("rbind")
<environment: 0x83862f4>
Methods may be defined for arguments: ...
Use  showMethods("rbind")  for currently available ones.
> removeGeneric("rbind")
[1] TRUE
> rbind
function (..., deparse.level = 1)
.Internal(rbind(deparse.level, ...))
<environment: namespace:base>
> setGeneric("order", signature="...",
+            function (..., na.last=TRUE, decreasing=FALSE)
+            standardGeneric("order"))
Creating a generic for "order" in package  ".GlobalEnv"
    (the supplied definition differs from and overrides the implicit generic
in package "base": Signatures differ:  (...), (na.last, decreasing))
[1] "order"
> rbind(1)
     [,1]
[1,]    1
> setGeneric("rbind", function(..., deparse.level=1)
standardGeneric("rbind"),
+            signature = "...")
Creating a generic for "rbind" in package  ".GlobalEnv"
    (the supplied definition differs from and overrides the implicit generic
in package "base": Signatures differ:  (...), (deparse.level))
[1] "rbind"
> rbind(1)
     [,1]
[1,]    1

##########################################################

That is, rbind(1) always returns the expected result. The rbind() generic is
set, then removed, the order() generic is set, and the rbind() generic is
set again. No problems.

But in a new session, this code breaks, where the rbind() generic is not set
before the order() generic:

########################################################

> setGeneric("order", signature="...",
+            function (..., na.last=TRUE, decreasing=FALSE)
+            standardGeneric("order"))
Creating a generic for "order" in package  ".GlobalEnv"
    (the supplied definition differs from and overrides the implicit generic
in package "base": Signatures differ:  (...), (na.last, decreasing))
[1] "order"
> rbind(1)
     [,1]
[1,]    1
> setGeneric("rbind", function(..., deparse.level=1)
standardGeneric("rbind"),
+            signature = "...")
Creating a generic for "rbind" in package  ".GlobalEnv"
    (the supplied definition differs from and overrides the implicit generic
in package "base": Signatures differ:  (...), (deparse.level))
[1] "rbind"
> rbind(1)
Error in .Method(..., na.last = na.last, decreasing = decreasing,
deparse.level = deparse.level) :
  object "na.last" not found

##############################################################

It looks like something is trying to send the parameters of order() to an
rbind() method. Weird..

Thanks,
Michael

> sessionInfo()
R version 2.9.0 Under development (unstable) (--)
i686-pc-linux-gnu

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to