[Rd] How to overload the assignment operator?

Simon Urbanek simon.urbanek at r-project.org
Tue Nov 13 15:52:37 CET 2007

On Nov 13, 2007, at 9:19 AM, Jens Oehlschlägel wrote:

> Thanks Matthias,
>> are you looking for "setReplaceMethod"?
> So far the package I m writing has avoided using anything from S4  
> and the implications of touching S4 are not clear to me. The package  
> aims on providing an alternative to 'atomic' data stored in ram,  
> i.e. large atomic data stored on disk. I need some advice how to do  
> this maximally performant, which probably means pure S3!?

You cannot use S3 here, because you want to dispatch on the *second*  

I don't think you want to do what you described - you would slow down  
everything in R considerably just by making `<-` a generic (and in  
fact you cannot do that for a good reason).

Why don't you take the external pointer approach that many others take  
to provide proxy objects to external data? (DB access, mem-mapped  
files, cross-language objects, etc.) That allows you to define your  
storage semantics very efficiently in C. You can still choose to  
define any syntactic sugar you want in either S3 or S4.


More information about the R-devel mailing list