std.serialization: pre-voting review / discussion

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Sat Aug 17 16:31:34 PDT 2013


I'd like to start off by saying I don't really know what I want 
from a std.serialize module. I've done some work with a C# JSON 
serializer and dealt with Protocol Buffers.

This library looks to be providing a means to serialize any D 
data structure. It deals with pointers/class/struct/arrays... It 
is export format agnostic, while currently only XML is available, 
allowing for export to JSON or some binary form. Afterwards the 
data can return to the program through deserialization.

This is a use-case I don't think I've needed. Though I do see the 
value in it and would expect Phobos to provide such functionality.

What I'm not finding in this library is a way to support a 3rd 
party protocol. Such as those used in Thrift or Protocol Buffers. 
These specify some aspects of data layout, for example in 
Protocol Buffers arrays of primitives can be laid out in two 
forms [ID][value][ID][value] or [ID][Length][value][value].

Thrift and Protocol Buffers use code generation to create the 
language data type, and at least for Protocol Buffers a method 
contains all the logic for deserializing a collection of bytes, 
and one for serializing. I'm not seeing how std.serialize would 
make this easier or more usable.

When looking at the Archive module, I see that all the specific 
types get their own void function. I'm unclear on where these 
functions are supposed to archive to, and container types take a 
delegate which I suppose is a means for the archiver to place 
output around the field data.

In conclusion, I don't feel like I've said very much. I don't 
think std.serialize is applicable to Protocol Buffers or Thrift, 
and I don't know what benefit there would be if it was.


More information about the Digitalmars-d mailing list