std.serialization: pre-voting review / discussion
ilya-stromberg
ilya-stromberg-2009 at yandex.ru
Tue Aug 20 23:45:31 PDT 2013
On Tuesday, 20 August 2013 at 15:07:39 UTC, Tyler Jameson Little
wrote:
> On Tuesday, 20 August 2013 at 13:44:01 UTC, Daniel Murphy wrote:
>> "Dicebot" <public at dicebot.lv> wrote in message
>> news:luhuyerzmkebcltxhgjj at forum.dlang.org...
>>>
>>> What I really don't like is excessive amount of object in the
>>> API. For example, I have found no reason why I need to create
>>> serializer object to simply dump a struct state. It is both
>>> boilerplate and runtime overhead I can't justify. Only state
>>> serializer has is archiver - and it is simply collection of
>>> methods on its own. I prefer to be able to do something like
>>> `auto data = serialize!XmlArchiver(value);`
>>>
>>
>> I think this is very important. Simple uses should be as
>> simple as
>> possible.
>
> +1
>
> This would enhance the 1-liner: write("file",
> serialize!XmlArchiver(InputRange));
>
> We could even make nearly everything private except an
> isArchiver() template and serialize!().
It will be great! Also, whith Uniform Function Call Syntax (UFCS)
it can be better:
InputRange.serialize!XmlArchiver.zip.save("file");
Also, we can provide a default Archiver type, for example
XmlArchiver or BinaryArchiver:
auto serialize(Archiver = BinaryArchiver, R)(R InputRange);
//Use default Archiver type
InputRange.serialize.zip.save("file");
More information about the Digitalmars-d
mailing list