From jmc at r-project.org  Sun May 30 18:12:37 2010
From: jmc at r-project.org (John Chambers)
Date: Sun, 30 May 2010 09:12:37 -0700
Subject: [Rd] S4 dispatch for .DollarNames (utils)
In-Reply-To: <httv0n$4pr$1@dough.gmane.org>
References: <4C00F8C2.4060508@r-enthusiasts.com>	<AANLkTimkEzQ5GLpnWHJr1EuBcNBmwod81UzBFs0fXusk@mail.gmail.com>	<4C016CE3.8050403@r-enthusiasts.com>	<4C01845E.5080102@r-project.org>
	<httv0n$4pr$1@dough.gmane.org>
Message-ID: <4C028E75.9040406@r-project.org>

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
>
>
>



[Rd] S4 dispatch for .DollarNames (utils)
John Chambers