[Rd] "Incompatible methods" for overloaded operator

Kohske Takahashi takahashi.kohske at gmail.com
Thu Jun 21 07:26:48 CEST 2012


In my view the class a and b should inherit same parent, like class c.
And S3methods should be defined for the class c.

Actually, this is not a workaround.
It will go with the more oop-ish design.

kohske

2012/6/21 Winston Chang <winstonchang1 at gmail.com>:
> On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
>
>> On 06/20/2012 08:06 PM, Hadley Wickham wrote:
>>
>>> But aren't the methods compatible?  If equality doesn't make a method
>>> compatible what does?
>>>
>>
>> Actually I guess that turns out to be the key (to why they work at the
>> command line but not in a package).  At the command line they really _are_
>> the same, e.g., .Internal(inspect("+.a")) has the same  address as "+.b".
>> In the package they (e.g., badadd:::"+.a") have different addresses, I
>> suppose because S3method() acts on them independently.
>>
>>
> Thanks for the investigation. I wonder if there's some sort of workaround.
>
>
>
>>
>>> But unfortunately that doesn't work for S3 classes (even with
>>> setOldClass) so it doesn't help much unless we want to rewrite
>>> everything in S4 :/
>>>
>>
>> rewrite?
>>
>
> Yes, the original question is the result of some issues that came up in
> ggplot2 development...
>
> -Winston
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Kohske Takahashi <takahashi.kohske at gmail.com>

Assistant Professor,
Research Center for Advanced Science and Technology,
The University of  Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html



More information about the R-devel mailing list