std.serialization: pre-voting review / discussion

Jacob Carlborg doob at me.com
Mon Aug 19 09:17:38 PDT 2013


On 2013-08-19 17:40, Jesse Phillips wrote:

> I not familiar with the interaction of Archive and Serializer. I was
> overwhelmed by the number of functions I'd have to implement (or in my
> case ignore) and ultimately I didn't know what my serialized data would
> look like.

std.serialization basically support any type in D (except for delegates 
and function pointers). If a particular method doesn't make sense to 
implement for a given archive, just implement a dummy function to 
satisfy the interface. The documentation for Archive says so:

"When implementing a new archive type, if any of these methods do not 
make sense for that particular implementation just implement an empty 
method and return T.init, if the method returns a value."

If something breaks due to this please let me know.

> I think it is possible to output a binary format which uses the same
> translation as Protocol Buffers, but I wouldn't expect it to resemble a
> message.

In the binary archive I'm working on I have chosen to ignore some parts 
of the implicit contract between the serializer and the archive. For 
example, I'm not planning to support slices, pointers to fields and 
similar complex features.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list