[Rd] modifying a persistent (reference) class

Gábor Csárdi csardi.gabor at gmail.com
Fri Aug 1 23:00:46 CEST 2014


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



More information about the R-devel mailing list