Request for review - std.serialization (orange)

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Sat Mar 30 13:02:47 PDT 2013


Hello Jacob,

These comments are based on looking into adding Protocol Buffer 
as an archive. First some details on the PB format.
https://developers.google.com/protocol-buffers/docs/overview

1) It is a binary format
2) Not all D types can be serialized
3) Serialization is done by message (struct) and not by primitives
4) It defines options which can affect (de)serializing.

I am looking at using Serializer to drive (de)serialization even 
if that meant just jamming it in there where Orange could only 
read PB data it has written. Keep in mind I'm not saying these 
are requirements or that I know what I'm talking about, only my 
thoughts.

My first thought was at a minimum I could just use a function 
which does the complete (de)serialization of the type. Which 
would be great since the pbcompiler I'm using/modifying already 
does this.

Because of the way custom serialization I'm stopped by point 3. I 
didn't realize that at first so I also looked at implementing an 
Archive. What I notice here is

* Information is lost, specifically the attributes (more 
important with UDA).
* I am required to implement conversions I have no implementation 
for.

This leaves me concluding that I'd need to implement my own 
Serializer, which seems to me I'm practically reimplementing most 
of Orange to use Orange with PB.

Does having Orange support things like PB make sense?

I think some work could be done for the Archive API as it doesn't 
feel like D2. Maybe we could look at locking down custom 
Archive/Serializer classes while the internals are worked out 
(would mean XML (de)serialization is available in Phobos).


More information about the Digitalmars-d mailing list