On 2013-09-04 14:37, ilya-stromberg wrote:
Jacob, can you add "@serializationName(string name)" UDA? I saw the custom serialization example from documentation: https://dl.dropboxusercontent.com/u/18386187/docs/std.serialization/std_serialization_serializable.html#.Serializableclass Foo : Serializable { int a; void toData (Serializer serializer, Serializer.Data key) { serializer.serialize(a, "b"); } void fromData (Serializer serializer, Serializer.Data key) { a = serializer.deserialize!(int)("b"); } } Whith "@serializationName(string name)" attribute example should look like this: class Foo { @serializationName("b") int a; } Or for class/struct name: @serializationName("Bar") class Foo { int a; } I think it's easier to use than custom serialization. And "@nonSerialized" UDA used for same purpose - simplify serialization customization.
@nonSerialized is already available. At the bottom of the link you posted.
Is it possible to implement?
Yes, the question is how much of these customization should be supported. It's easy to add at a later time if I don't add it from the beginning.
-- /Jacob Carlborg
