[Rd] S3 vs S4 for a simple package

From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>
Date: Mon, 7 Jan 2008 09:03:27 +0000


I am writing a package and need to decide whether to use S3 or S4.

I have a single class, "multipol"; this needs methods for "[" and "[<-" and I also need a print (or show) method and methods for arithmetic +- */^.

In S4, an object of class "multipol" has one slot that holds an array.

Objects of class "multipol" require specific arithmetic operations; a,b being
multipols means that a+b and a*b are defined in peculiar ways that make sense in the context of the package. I can also add and multiply
by scalars (vectors of length one).

My impression is that S3 is perfectly adequate for this task, although I've not yet finalized the coding.

S4 seems to be "overkill" for such a simple system.

Can anyone give me some motivation for persisting with S4?

Or indeed reassure me that S3 is a good design decision?

--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 07 Jan 2008 - 09:05:57 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 Mon 07 Jan 2008 - 22:30:08 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.

list of date sections of archive