On Wednesday, 14 August 2013 at 09:26:55 UTC, Jacob Carlborg wrote:
On 2013-08-14 11:17, Tove wrote:
I find the newstyle both more intuitive and you also more dry not
duplicating the identifier: "int b; mixin NonSerialized!(b)"

@nonSerialized struct Foo
{
    int a;
    int b;
    int c;
}

struct Bar
{
    int a;
    int b;
    @nonSerialized int c;
}

Absolutely.

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#.Serializable

class 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.

Is it possible to implement?

Reply via email to