In-Reply-To: <[EMAIL PROTECTED]> On Thu, 12 Dec 2002 19:35:14 -0800 (PST) Augustus Saunders ([EMAIL PROTECTED]) wrote: > Me: I'm not sure what kind of generic versioning we can provide. > What benefit do we provide over the application author > serializing/deserializing his or her own version?
Java does quite a lot in this line. It has enough metadata available, both of the running program and in the archive, to be able to detect missing or surplus fields, changes in inheritance hierarchy etc, and fix them up. Many tagged formats (including XML and RTF) are designed to allow unexpected or unknown fields to be skipped during loading. Some of this is doable within the frame work I have in mind. For example, given code like: void MyClass::load( iarchive &ar ) { ar.begin( "MyClass" ); ar >> tag("name") >> name; ar >> tag("address") >> address; ar >> tag("zipcode") >> zipcode; ar.end(); } if the archive does not contain a "zipcode" field, the zipcode variable would not be modified. Any fields provided in the archive and not read by the time ar.end() is called, would be discarded. It would even be possible to allow the archive to provide the fields in reverse order. Eg the data could look like either: <MyClass><name>Fred</name><zipcode>12345</zipcode></MyClass> or: <MyClass><zipcode>12345</zipcode><name>Fred</name></MyClass> This would mean reading all the data in advance and storing it in some kind of tree structure. The UDT code shown would actually traverse the tree and use random access at each node. Like you, I question the value of doing this stuff. It makes me feel uneasy. -- Dave Harris _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost