std.serialization: pre-voting review / discussion

Tyler Jameson Little beatgammit at gmail.com
Fri Aug 23 07:39:31 PDT 2013


On Friday, 23 August 2013 at 13:39:47 UTC, Dicebot wrote:
> On Friday, 23 August 2013 at 13:34:04 UTC, ilya-stromberg wrote:
>> It's a serious issue. May be it's more important than range 
>> support. For example, I have to change class (bug fixing, new 
>> features, etc.), but it comparable with previos version 
>> (example: it's always possible to convert "int" to "long"). I 
>> that case I can't use std.serialization and have to write own 
>> solution (for examle, save data in csv file).
>
> I don't think it as an issue at all. Behavior you want can't be 
> defined in a generic way, at least not without lot of UDA help 
> or similar declarative approach. In other words, the fact that 
> those two classes are interchangeable in the context of the 
> serialization exists only in the mind of programmer, not in D 
> type system.
>
> More than that, such behavior goes seriously out of the line of 
> D being strongly typed language. I think functionality you want 
> does belong to a more specialized module, not generic 
> std.serialization - maybe even format-specific.

What about adding delegate hooks in somewhere? These delegates 
would be called on errors like invalid type or missing field.

I'm not saying this needs to be there in order to release, but 
would this be a direction we'd like to go eventually? I've seen 
similar approaches elsewhere (e.g. Node.js's HTTP parser).


More information about the Digitalmars-d mailing list