[Rd] Standard method for S4 object

Tim Hesterberg timh at insightful.com
Mon Feb 25 19:44:43 CET 2008


Hi Oleg,

If there as a class to inherit from, then my point about an S4 class
requiring lots of methods is moot.  I think it would come down then to
whether one prefers flexibility (advantage S3) or a definite structure
for use with C/C++ (advantage S4).

Tim

>well, I am not arguing that there are situation when one needs to 
>rewrite everything from scratch. However it is always worth at least 
>considering inheritance if there is a candidate to inherit from. It 
>saves a lot of work.
>
>Anyway, your examples of S3 class usage are obviously valid in sense 
>that they are indeed S3 methods providing desired functionality. 
>However, I still do not see WHY using attributes with S3 is better than 
>slots and S4 for structures like those inherited from 'array' or 
>similar. S3 gives more freedom in assigning new attributes, but this 
>freedom also means that one has little control over the structure of an 
>object making it, for example, more difficult to use with C/C++ code. 
>Are there any specific benefits in not using S4 and slots (apart from 
>some known performance issues)?



More information about the R-devel mailing list