std.serialization: pre-voting review / discussion

Jacob Carlborg doob at me.com
Sun Aug 18 12:45:59 PDT 2013


On 2013-08-17 10:29, glycerine wrote:

> Huh? Do you know what thrift does? Summary: Everything that
> Orange/std.serialization does and more. To the point: Thrift
> provides data versioning, std.serialization does not. In my book:
> end of story, game over. Thrift is preffered choice. If you
> are going to standardize something, standardize the Thrift
> bindings so that the compiler doesn't introduce regressions
> that break them, like happened from dmd 2.062 - present.

Orange/std.serialization is capable of serializing more types than 
Thrift is. Example it will correctly serialize and deserialize slices, 
pointers and so on.

It's easy to implement versioning yourself, something like:

class Foo
{
     int version_;
     int a;
     int b;

     void toData (Serializer serializer, Serializer.Data key)
     {
         serializer.serialize(a, "a");
         serializer.serialize(version_, "version_");

         if (version_ == 2)
             serializer.serialize(b, "b");
     }

     // Do the corresponding in "fromData".
}

If versioning is crucial it can be added.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list