On Friday, 5 June 2015 at 12:53:45 UTC, Basile Burg wrote:
On Friday, 5 June 2015 at 12:21:19 UTC, Sean Campbell wrote:
On Tuesday, 2 June 2015 at 10:32:25 UTC, Basile Burg wrote:
[...]
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.

[...]
thank you, it's good to know
[...]

No, you don't get my point with setters: if a during the deserialization you restore, let's say, the _width field and that 12 children controls rely on this field then they won't be aware of the change. But if the deserializer restores using the width(int value) setter, the children can be resized if the the setter contain a sub method like updateChildren()...
just add @customSerialized to _width and make deserialize_width call updateChildren() or whatever

Reply via email to