[Rd] SV4 on R?

John Chambers jmc@research.bell-labs.com
Thu, 13 Sep 2001 15:08:26 -0400


Prof Brian D Ripley wrote:
> 
> On Thu, 13 Sep 2001, Frank E Harrell Jr wrote:
> 
> > Dear R-Developers,
> >
> > The traffic today on s-news where Terry Therneau, I, and others
> > are reporting some of the problems we have had using or
> > converting applications to SV4 reminded me of something
> > Duncan Temple Lang had mentioned to me a year ago that
> > I wanted to follow up on.  I recall that Duncan said either that if SV4
> > were to be implemented in R that it would not be
> > the default behavior, or that through an option the
> > new behavior could be turned off.  Would you mind
> > bringing me up to date on this?  I sincerely hope
> > that what I thought Duncan said last year still
> > applies.  Thank you very much for your consideration.  -Frank
> 
> There are lots of aspects of S4 behaviour.  Some R already has
> (connections, preserving logicals in data frames, for example).  I guess
> you are concerned about classes. There I don't think a decision has been
> taken.  There is a `methods' package in R-devel, written by John Chambers
> that is not yet finished (or I believe so, as it is being changed quite
> rapidly and is only partially documented).  What is likely is that in R
> 1.4.0 all objects will have classes, and that functions like identical(),
> as() and is() will be available.  So far this has caused only a few
> problems, mainly because there are not problems like the "named" class
> presents in S4. (Bit of background: any vector with names in S4 is of class
> "named", and that includes lists with names.)
> 
> Assuming we decide to keep it I don't expect that all objects will have a
> class is not going to be optional.  You will get classes like "numeric"
> from class(x).  I think that's a good move.  It does mean that a test for
> null class should be a test of !is.object(x), probably.

In the current 1.4, the new definitions are in a package "methods". 
Unless that package is attached, the old versions (only) apply,
including the definition of class.  So at present, you can have the
old-style class definition if you want.  In the long run, that may
change as Brian suggests.

In the R context, there are a number of future plans such as threading,
namespaces and compiling.  Defining those using the "S3" model seems to
me to be difficult and undesirable.  Luke and Duncan can comment more
authoritatively, since they are mainly responsible.

> I do think you and Terry and others are being too negative. The problems
> are not with designing new S4 classes to do the job, but porting S3 ones.
> I believe too few people have tried to re-design to make use of S4 classes
> for there to be enough evidence.  FWIW, MASS and nnet have been using
> S4 classes for a few years quite sucessfully: we re-designed the classes.
> We stopped because no one else seemed to be moving, and the basic modelling
> functions are still confined to S3-style objects.
> 
> Brian
> 
> --
> Brian D. Ripley,                  ripley@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
John M. Chambers                  jmc@bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._