[R] "privileged slots",

Martin Maechler maechler at stat.math.ethz.ch
Tue Jun 1 14:49:36 CEST 2004


>>>>> "Jari" == Jari Oksanen <jarioksa at sun3.oulu.fi>
>>>>>     on 01 Jun 2004 12:44:09 +0300 writes:

    Jari> 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<-".
    >> 
    Jari> There are several other things that were fully
    Jari> documented and still were removed. One of the latest
    Jari> cases was print.coefmat which was abruptly made
    Jari> Defunct without warning or grace period: 
    Jari> code written for 1.8* didn't work in 1.9.0 and if
    Jari> corrected for 1.9.0 it wouldn't work in  pre-1.9.0. 

that's wrong.
In 1.8.*  every use of print.coefmat() would give a warning,
e.g.,

  > print.coefmat(cmat)
       Estimate Std.Err Z value    Pr(>z)    
  [1,]  10.2645  3.6570  2.8068  0.005004 ** 
  [2,]   8.6213  3.0335  2.8420  0.004483 ** 
  [3,]  11.8762  1.9379  6.1284 8.875e-10 ***
  ---
  Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 
  Warning message: 
  'print.coefmat' is deprecated.
  Use 'printCoefmat' instead.
  See ?Deprecated. 

which tells you what to use instead.
So there was a 6-month "grace period" (and that's the rule: one
cycle of 'deprecated' before 'defunct').

And as Roger Bivand just mentioned: You could have gotten that
warning even considerably earlier -- when 1.8.0 was R-devel,
all CRAN packages using print.coefmat() -- in code that is
executed in the package examples or 'tests --- had been listed as
giving warnings on the CRAN package check page 
{from CRAN main page  --> sidebar[Packages] has a section 
 'Daily package check results'}

    Jari> Anything can change in R without warning,
    Jari> and your code may be broken anytime. Just be prepared.

I can understand your feelings, but your statement 
is quite a bit exaggerated, see above.

Martin




More information about the R-help mailing list