Deserializing const fields
Jacob Carlborg
doob at me.com
Wed Sep 5 00:08:33 PDT 2012
I hit an interesting problem in my serialization library: deserializing
const (and immutable) fields. The problem is that const fields need to
be set in a constructor.
In my current implementation I don't call the constructor at all. The
reason for this is that I want to be able to (de)serialize classes
without a default constructor. Instead it's possible to register event
handlers for when a class is deserialized.
So I think that I either need to require that a class with const fields
need to have a default constructor or a constructor that takes the
serializer as an argument and leave the class to manually deserialize
the const fields in the constructor.
Anyone got any other ideas?
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list