Serialization + semantics of toString

aarti_pl aarti_no_spam_ at interia.pl
Fri Nov 13 00:13:07 PST 2009


Andrei Alexandrescu Wrote:

> aarti_pl wrote:
> > I forgot to throw a link:
> > 
> > http://www.dsource.org/projects/doost/browser/trunk/examples/util/serializer/FunctionTest.d 
> 
> Cool, do you also have documentation?
> 
> Andrei

Well, that's definitely weak point of this library. :-) 

You can find some information on doost wiki: 
http://www.dsource.org/projects/doost/wiki
There are also some DDOC comments in code. It's also worthy to look on Boost serialization library description, as my library is based on it.

Anyway I will try to improve documentation a bit during weekend.

Additionally I would like to mention that there is also great BinaryArchive from Bill Baxter, which I didn't mention in my first post.

---

I think that the most interesting question is if we can replace toString() with template based solution? So instead of:
String toString()

we would write e.g.:
void describe(T)(T archive) {
}

Some other things should be considered:
* What about virtual calls to describe? Currently template methods are not virtual, but I remember that there were posts that it is possible in some limited way.
* Is it semantically same solution as toString()? Or toString() is used for something other than describing members of class? 
* If toString() is used for other things than describing class/struct fields, then do we need a standard way to do this or should it be implementation specific?
* Solution with template method seems to be more general, as there might be different customization of output for every kind of archive, but isn't it too much for simple uses? Maybe string output is just enough?
* Should be there some default archive available or should it be always defined by user?

Best Regards
Marcin Kuszczak
(aarti_pl)




More information about the Digitalmars-d mailing list