[R] 2 setGeneric's, same name, different method signatures

Hadley Wickham h.wickham at gmail.com
Fri Feb 15 23:39:47 CET 2013


This is unfortunately reinforced by the "(Not So) Short Introduction
to S4 Object Oriented Programming in R" - I wouldn't recommend that
document to learn about S4.

The most important thing to get about OO in R is that methods belong
to generic functions, not like classes, as in most other programming
languages.  If you don't get that, you are really going to struggle
with S3 and S4 and you will wonder what on earth the designers of R
were thinking when they created them.

Hadley

On Fri, Feb 15, 2013 at 3:42 PM, William Dunlap <wdunlap at tibco.com> wrote:
> I thought you were thinking of the R class system (the S3 and S4 ones
> anyway) as if it were C++'s.  It is quite different.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
>> -----Original Message-----
>> From: Greg Minshall [mailto:minshall at umich.edu]
>> Sent: Friday, February 15, 2013 1:37 PM
>> To: William Dunlap
>> Cc: r-help at r-project.org
>> Subject: Re: 2 setGeneric's, same name, different method signatures
>>
>> William,
>>
>> > and here mention "intra-class name clashes" (I'm not sure what you
>> > mean by this).
>>
>> sorry, i meant, in something like C++, if i have a class Foo and you
>> have a class Bar, then i can invent whatever method names/signatures i
>> want, independent of whatever method names/signatures *you* want.  *i*
>> just need to make sure i don't introduce incompatible methods with the
>> same name/signature *within* Foo.
>>
>>
>> cheers, Greg
>
> ______________________________________________
> R-help at 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.



-- 
Chief Scientist, RStudio
http://had.co.nz/



More information about the R-help mailing list