Skip to content
Prev 26672 / 63424 Next

How to overload the assignment operator?

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

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

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.

Cheers,
Simon