On Tuesday, 2 June 2015 at 10:32:25 UTC, Basile Burg wrote:
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

We are many on this segment. Your one is "under-featured". One thing i need in serialization is the use of prop getter to serialize and prop setter to deserialize (*) and not only a dump of the fields that __traits() can find.
using property setters and getters doesn't seem like the best idea
as they may either:
they are used to get live data e.g. setter calls hashing function
for an object that isn't part of the class/struct

property may only have setter or getter not both.

but in case you need to store anything that __traits() can find
I added support for custom serialized fields and types.
just annotate a type with @customSerialized and define
the static methods serialize[membername] and deserialize[membername]
where [membername] is the name of the field or have full custom
serialization by defining the static methods serializeThis
and deserializeThis.


That's why i also done mine:

https://github.com/BBasile/iz/blob/master/import/iz/serializer.d

based on the concept of property descriptor, UDA anotations:

https://github.com/BBasile/iz/blob/master/import/iz/properties.d

However still not happy with it...
Maybe with every other examples that people gave you, you'll get a better idea of how to design the thing.

One plus is that your code is very clean.
thank you, it's good to know
---

(*): an obvious reason is that when you change a piece in an engine you don't just drop it under the hood and it's done. You have to demount and remount a lot of pieces...that's what the setters do silently.

Reply via email to