[R] "privileged slots",

Jari Oksanen jarioksa at sun3.oulu.fi
Tue Jun 1 11:44:09 CEST 2004


On Tue, 2004-06-01 at 12:21, Torsten Steuernagel wrote:
> On 28 May 2004 at 8:19, Duncan Murdoch wrote:
> 
> > I'd advise against doing this kind of optimization.  It will make your
> > code harder to maintain, and while it might be faster today, if "@<-"
> > is really a major time sink, it's an obvious candidate for
> > optimization in R, e.g. by making it .Internal or .Primitive.  When
> > that happens, your "optimized" code will likely be slower (if it even
> > works at all).
> 
> Agreed. I don't recommend doing this either. I don't believe it makes 
> any difference using "slot<-" instead of "@<-" in real life. Anyway, that 
> "optimized" code should always work (slower or not) because "slot<-" 
> is fully documented and I don't see why it should be removed or its 
> behaviour should change. That wouldn't only break the kind of code 
> mentioned here but also everything else that makes use of "slot<-".
> 
There are several other things that were fully documented and still were
removed. One of the latest cases was print.coefmat which was abruptly
made Defunct without warning or grace period: code written for 1.8*
didn't work in 1.9.0 and if corrected for 1.9.0 it wouldn't work in
pre-1.9.0. Anything can change in R without warning, and your code may
be broken anytime. Just be prepared.

cheers, jari oksanen 
-- 
Jari Oksanen <jarioksa at sun3.oulu.fi>




More information about the R-help mailing list