From csardi.gabor at gmail.com  Fri Aug  1 23:00:46 2014
From: csardi.gabor at gmail.com (=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=)
Date: Fri, 1 Aug 2014 17:00:46 -0400
Subject: [Rd] modifying a persistent (reference) class
In-Reply-To: <1406926072.9451.90.camel@localhost>
References: <1406915617.9451.47.camel@localhost>
	<852F505F-BB94-4825-A118-40D685240574@muxspace.com>
	<1406920680.9451.64.camel@localhost>
	<6AF0CD15-A22B-4072-9A29-C184FF4E5DA2@muxspace.com>
	<1406926072.9451.90.camel@localhost>
Message-ID: <CABtg=KmbOqBiUmW_mAjShCRYKnFcfkbE17Hwi3_=0TtAHLEH9A@mail.gmail.com>

On Fri, Aug 1, 2014 at 4:47 PM, Ross Boylan <ross at biostat.ucsf.edu> wrote:
[...]
> First, I'd like to understand more about exactly what is saved to disk
> for reference and other classes, in particular how much meta-information
> they contain.  And my mental model for reference class persistence is
> clearly wrong, because in that model instances based on old definitions
> come back intact (albeit not with the new method definitions or other
> new slots), whereas mine seemed to come back damaged.
>
> Second, I'm still hoping for some elegant way around this problem (how
> to redefine classes and still use saved versions from older definitions)
> for the future, both with reference and regular classes.  Or at least
> some rules about what changes, if any, are safe to make in class
> definitions after an instance has been persisted.
>>
> Third, if changes to R could make things better, I'm hoping some
> developers might take them up.  I realize that is unlikely to happen,
> for many good reasons, but I can still hope :)

I believe that the brand new R6 class system can do this. I mean your
saved instances from old classes will be read back properly, with the
old methods. They are on CRAN and also here if you want to experiment:
https://github.com/wch/R6

Best,
Gabor



[Rd] modifying a persistent (reference) class
=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=