From spluque at gmail.com  Wed Sep  8 17:36:55 2010
From: spluque at gmail.com (Seb)
Date: Wed, 08 Sep 2010 10:36:55 -0500
Subject: [Rd] How to add a slot to S4 class of an existing package?
References: <494FECF9.2020301@aon.at> <495954FE.6070401@ebi.ac.uk>
	<878w3df7hx.fsf@kolob.sebmags.homelinux.org>
	<AANLkTikJ336mVCnvAD3k-COMffzz_Bc0aJkRAPPyRhni@mail.gmail.com>
Message-ID: <87occ8dz6w.fsf@kolob.sebmags.homelinux.org>

On Tue, 7 Sep 2010 20:41:14 -0400,
Kasper Daniel Hansen <kasperdanielhansen at gmail.com> wrote:

> Seb That thread and the resources in Biobase assumes that you have a
> class that extends "Versioned".  Doing so will help you in the long
> run by providing you with updateObject (at the cost of some
> complexity).  However, it does not really help you if the existing
> class does not extend Versioned.

Thanks Kasper, indeed the class I'm working with doesn't have anything
to do with Biobase, and having it extend "Versioned" along with the
package dependencies only for this purpose seems overkill in my case.
But perhaps one can implement a similar approach internally in the
package without having to add a new dependency.


> In general, adding a new slot should not break any existing code, but
> you may find users who have old objects lying around that they cannot
> use with the new functionality (I assume you are adding slots to
> provide new functionality).

Yes, the new slot adds new functionality and I also thought that adding
a slot should not affect existing code.  However, an error message
during 'R CMD check' came up to the effect that an object did not have
the new slot.  Unfortunately, I didn't save more details nor
investigated this error any further, but it got me doubting whether
adding the slot would break existing code and access to objects of the
older class.  The object is under data/, although now I'm considering
removing it and creating it in an example, which might be cleaner.


-- 
Seb



[Rd] How to add a slot to S4 class of an existing package?
Seb