Serialization for D. Comments, please!

BCS none at anon.com
Tue May 19 23:08:46 PDT 2009


Hello Brad,

> (moved from .announce to dm.D)
> 
> 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)
>> 
> I strongly suggest figuring out early how you want to support multiple
> serialization formats.  From experience, it's deceptively difficult to
> splice that into the design later.
> 

I'm already puzzling over that one <g>

> As for invocation, consider making the deserialization a constructor.

The problem with making it a constructor is that it dosn't match with structs.

> I assume that in the example that the Deserialize method was static
> and acts as a factory?

yes. 

> Another point for you to ponder... do you want to support builtin
> types as a top level serialization point.  ie, can you serialize a
> single int or must it be a struct or class or aggregate?  If you _do_
> want to support it, consider what will happen for formats that don't
> support it, such as xml and json.

I was thinking it would end up as a string wrapped in a tag (for XML):

<int>42</int>





More information about the Digitalmars-d mailing list