Serialization + semantics of toString

Bill Baxter wbaxter at gmail.com
Fri Nov 13 08:22:02 PST 2009


On Fri, Nov 13, 2009 at 7:14 AM, aarti_pl <aarti_no_spam_ at interia.pl> wrote:
> Bill Baxter Wrote:
>
>> On Fri, Nov 13, 2009 at 12:13 AM, aarti_pl <aarti_no_spam_ at interia.pl> wrote:
>> > Andrei Alexandrescu Wrote:
>> >
>> > Additionally I would like to mention that there is also great BinaryArchive from Bill Baxter, which I didn't mention in my first post.
>>
>> There is?  Completely forgot about that.
>>
>> If I recall the big wish list item I had for your serializer was
>> robust subclass handling for things like serializing a BaseClass[]
>> with a mix of pointers to BaseClass and DerivedClass.  You need to be
>> able to de-serialize that by saying something like
>> unserialize!(BaseClass[]).  I think at the time I tried it, your
>> serializer didn't save enough info to know the proper derived class to
>> load up.
>>
>> --bb
>
> This is still missing. The problem I had is that template functions are not virtual, so I can not get derived class which should be dumped. But I think it can be doable: just needs some more time and thinking.

Well, it was definitely possible, even a year ago, because Tom S.'s
serializer in xf could do it, though I don't recall how. It was quite
complicated.   Layers and layers of ctfe code instantiating templates
creating more code via ctfe, or something like that.

> Now typeid() gives type of most derived class, so maybe this is a way?

Yeh, definitely seems like that could help.

--bb



More information about the Digitalmars-d mailing list