Working on new binary serialization module for phobos (hopefully)

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 1 08:11:53 PDT 2015


On Monday, 1 June 2015 at 12:52:45 UTC, Sean Campbell wrote:
> I've been working on a new serialization module for Phobos and 
> its only reliant on 4 Phobos modules
> it is available at 
> https://github.com/sycam0inc/phobos/blob/master/std/experimental/serialization.d
>
> I would like some feedback on it

I'm biased since I wrote this: 
https://github.com/atilaneves/cerealed.

At a glance, I don't like at all that types have to opt-in to be 
serialised. Why the limitation?

You don't need reverseOf, just use std.range.retro.

Cerealed has more features than this as well. I'd struggle to 
write code as short as I did when using it to implement 
networking protocols. I also only encoded bytes as big-endian 
since binary serialization is usually followed by sending those 
bytes over the wire. Given you check the endianess of the system 
here, how would that work?

I liked the union trick, I wonder why I didn't think of that. 
Well, there's the endianness problem I guess.

Atila


More information about the Digitalmars-d mailing list