From pgilbert at bank-banque-canada.ca  Tue Aug 12 14:02:56 2003
From: pgilbert at bank-banque-canada.ca (Paul Gilbert)
Date: Tue Aug 12 19:04:39 2003
Subject: [Rd] s4 methods and base
In-Reply-To: <3F380492.ED19612C@research.bell-labs.com>
References: <8CBAA121CEB4D5118CB200508BB2BBEF0317E8F4@xmx8lonib.lonib.commerzbank.com>
	<3F380492.ED19612C@research.bell-labs.com>
Message-ID: <3F391DC0.4010701@bank-banque-canada.ca>

John

> But maintainers of software using S3 methods and classes
> might want to consider conversions or partial conversions, when and if
> they decide to revise the software.  

I'm curious about the logistics of a partial conversion. Initially I 
think I will avoid classes that inherit from other classes. But what 
general approach would you suggest for classes that have an object of 
another class in their structure. Can the larger object be an S4 class 
and the contained object an S3 class, or would you start the other way 
around, or is it not possible?

Also, would you suggest converting to namespaces before or after 
converting to S4 classes?


> With S4 classes, every object has a single class, with an explicit
> definition.  That class can have superclasses  (defined as the classes
> this class contains).

(newbie question) Are you using "contains" as a synonym for "extends," 
meaning that many classes can contain the same superclass, or is this 
intending to indicate that the logic is the reverse of (my understanding 
of) S3 logic?


>  - classes that don't have multiple strings in the class attribute can
> often just be converted to a non-virtual S4 class, so long as objects
> always have the same attributes.  Attributes go into slots (the slot
> must have some specified class, but there are ways to allow some
> variation in the actual type of data in the slot).

(newbie question) I often use attributes to stick "extra" information on 
an object, like the date of retrieval from a database onto a matrix. If 
the matrix is an S4 matrix class, does this mean that I have to define a 
new class in S4 that extends the matrix class in order to stick on extra 
information?

Thanks,
Paul Gilbert


[Rd] s4 methods and base
Paul Gilbert