Serialization for D. Comments, please!

BCS none at anon.com
Tue May 26 18:59:40 PDT 2009


Hello Qian,

> BCS wrote:
> 
>> I'm planning on taking a crack at a Serialization template library
>> and I'm looking for feed back. My thinking so far is up on my blog
>> here:
>> 
> http://arrayboundserror.blogspot.com/2009/05/serialization-for-d-part-
> 1-of-n.html
> 
>> Please comment! (here or there, doesn't matter, I think I'll see
>> both)
>> 
> A question:
> Should every object contain "mixin Serializable!()" in its
> declaration? It is easy to add this in own classes, but
> not easy to 3rd-party libraries. for instance: tango
> --Qian
> 

I've been mentally dodging that question because it's going to be ugly. If 
anyone has some ideas on how to make it work, I'm interested.

Right now the system has a hard coded list of basic types (byte, real, etc.) 
that it can work with and failing that, it assume you have added "mixin Serializable!()". 
The main problem is getting the third case is overload. Overloading doesn't 
work across mixins or modules last I checked. It would be a hack, but named 
function called via string mixins (mixin("Marshal"~ typeof(a).stringof ~ 
"(sink,a);")) might work.




More information about the Digitalmars-d-announce mailing list