std.serialization: pre-voting review / discussion

Jacob Carlborg doob at me.com
Wed Aug 28 11:41:14 PDT 2013


On 2013-08-28 18:02, ilya-stromberg wrote:

> Maybe you are right.
> But I think it's not so difficult to implement, at least for simle cases.
> We can follow a simple rules, for example like this:
>
> Does element "b" exists in the archive? - Yes.
> Does element "b" has type "long"? - No, the type is "int".
> Can we convert type "int" to "long"? - Yes, load element "b" to tempory
> variable and convert it to "long":
>
> int _b = 4;
> long b = to!long(_b);
>
> Is it difficult to implement?
> Also, we can provide a few deserialize models: strict (like current
> behavior) and smart (like example above). May be even 3 levels: strict,
> implicit conversions (like int to long) and explicit conversions (like
> long to int).

I don't think we should add too much of this kind of functionality. 
There's a reason for why it supports custom serialization. This is a 
perfect example.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list