Claudia,
Your S3 methods will be selected for objects from "hyperSpec", but not
for S4 classes that inherit from that class (that have
contains="hyperSpec" in their definition).
The S3 method dispatch has been fixed to recognize S4 classes that
inherit from an S3 class, "foo3" in my example.
The plan is to fix that for the next release, and have S3 dispatch
behave for all S4 objects, not just those that inherit from an S3
class. Meanwhile, the dummy class is needed.
On 5/30/10 8:08 AM, Claudia Beleites wrote:
Dear all,
thank your for this discussion - I had been wondering how to get the
completion with my S4 class, but it didn't bother me enough to dig
into things.
The workaround/hack that *does* work now, I believe, is to insert a
dummy S3 class into the mix and define the S3 .DollarNames method for
it.
Example:
> setOldClass("foo3")
> .DollarNames.foo3 <- function(x, pattern)"bar"
My question here is: what is the dummy class needed for?
I have a few S3 methods for my S4 class (rbind.hyperSpec,
cbind.hyperSpec, and now .DollarNames.hyperSpec). They seem to work
just fine without first setting up a dummy S3 class that is then used
in the contains of the S4 definition.
Any pitfalls with that?
Claudia
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel