std.serialization: pre-voting review / discussion

ilya-stromberg ilya-stromberg-2009 at yandex.ru
Tue Aug 13 23:29:29 PDT 2013


On Tuesday, 13 August 2013 at 15:04:38 UTC, Jacob Carlborg wrote:
>
> There's a fully working example here:
>
> https://dl.dropboxusercontent.com/u/18386187/docs/std.serialization/std_serialization_serializer.html

Sorry, I think that example is WRONG!
Your example:

void main ()
{
     auto archive = new XmlArchive!();
     auto serializer = new Serializer;

     auto foo = new Foo;
     foo.a = 3;

     serializer.serialize(foo);
     auto foo2 = serializer.deserialize!(Foo)(archive.untypedData);

     writeln(foo2.a); // prints "3"
     assert(foo.a == foo2.a);
}

As I can see, it should be:

     auto archive = new XmlArchive!();
     auto serializer = new Serializer(archive);

Please fix example or correct me.

Note that current DDocs version supports to generate 
documentation from unittests - it lets as make shure that 
documentation is correct. Shall we add the condition of examples 
generation from unittests as required?


More information about the Digitalmars-d mailing list