std.serialization: pre-voting review / discussion

Tove tove at fransson.se
Wed Aug 14 02:17:43 PDT 2013


On Wednesday, 14 August 2013 at 08:48:23 UTC, Jacob Carlborg 
wrote:
> On 2013-08-14 10:19, Tyler Jameson Little wrote:
>> - Typo: NonSerialized example should read NonSerialized!(b)
>
> No, it's not a typo. If you read the documentation you'll see 
> that:
>
> "If no fields or "this" is specified, it indicates that the 
> whole class/struct should not be (de)serialized."

I understand the need for Orange to be backwards compatible, but 
for std.serialization, why isn't the old-style mixin simply 
removed in favor of the UDA.

Furthermore for "template NonSerialized(Fields...)" there is an 
example, while for the new style "struct nonSerialized;" there 
isn't!

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;
}


More information about the Digitalmars-d mailing list