From: Anatoli Tubman (anatoli_at_[hidden])
Date: 2004-03-31 02:30:08
My boss just gave me OK to discuss this, so here goes. Please
excuse me if it has been brought up before. Please excuse me also
if what follows is just downright stupid.
A common drawback of various serialization libraries is the need to
provide versioning code for each data structure to be serialized. This
need not be the case for XML archives (and other formats that store
NVPs). Because the program knows which data members it needs, and
the names are stored in the archive, the program can leave any missing
members in their current state (typically just after construction) and
ignore any extra ones. After all, this is one of the ideas behind XML!
More often than not this tactic is sufficient to handle versioning. When
it's not, there's always the old way of explicit version checks.
It seems that this should be easy to implement for boost::serialization.
Just make two passes through the deserialization function. In the first
pass, just collect information on data members to be deserialized into
some kind of map keyed on tag. In the second pass, perform actual
deserialization, looking at the map built in the first pass. Any tags
in the archive but not in the map are ignored together with their
I'm not sure whether current serialization syntax can or should be used
with this functionality.
Best of luck,
-- Anatoli Tubman PTC Israel (Haifa) Tel. (+972) 4-8550035 ext. 229