Re: [Rd] How to overload the assignment operator?

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Tue, 13 Nov 2007 09:52:37 -0500

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* 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



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 13 Nov 2007 - 14:58:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 13 Nov 2007 - 15:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.