Serialization for D. Comments, please!

Brad Roberts braddr at puremagic.com
Tue May 19 22:45:18 PDT 2009


(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.

As for invocation, consider making the deserialization a constructor.  I assume
that in the example that the Deserialize method was static and acts as a factory?

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 agree with the limitations you've listed, but it does restrict the scope of
data structures that can be serialized (or at least successfully round-tripped
and remain in-tact).

Later,
Brad




More information about the Digitalmars-d mailing list