Serialisation
Opened this issue · 2 comments
As with modules, this is hard to get right. See package XML, which has xmlSerializeHook
and xmlDeserializeHook
to help.
For some types of objects storing a copy of the data in the RcppR6 object's R environment could help. Keeping things in sync is hard. But if we could do that it might be possible to store enough to rebuild the object and provide a hook to do that.
At the least, it should be possible to facilitate load/save, even if we have to use the RApiSerialize interface to do this.
However, that doesn't deal with the case where an object is saved because it is itself a part of another object (e.g. in a list). In theory saveRDS
's refhook
should be able to help out here, but I don't see that it can be set to be triggered by object type.