On 2013-08-18 01:31, Jesse Phillips wrote:
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].

I have had a brief look at Protocol Buffers and I don't see why it wouldn't work as an archive. I would probably need to implement a Protocol Buffers archive type to see what the limitations of std.serialization and Protocol Buffers are.

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.

If a Thrift or Protocol Buffers archive would be used with std.serialization I'm thinking that one would skip that step and have the data types defined directly in D.

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

The archive holds the data. When the serialization is complete the data can be accessed using "archive.data".

, and container types take a delegate which I
suppose is a means for the archiver to place output around the field data.

Yes, exactly. It lets the archive know where a structured type begins and ends.

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.


--
/Jacob Carlborg

Reply via email to