On 2011-08-07 21:28, dsimcha wrote:
In addition to the bug reports I filed, why is it necessary to write any
serialization code to serialize through the base class? What's wrong
with just doing something like:
class Base {}
class Derived : Base {}
void main() {
auto serializer = new Serializer(new XMLArchive!());
// Introspect Derived and figure out all the details automatically.
serializer.register!(Derived);
}
I've been thinking about this and currently I don't see how this would
be possible. When serializing through a base class reference the static
type would be of the base class. But what I need is the static type of
the subclass, to be able to loop through the tuple returned by tupleof.
The only information I can get about the subclass is basically the fully
qualified name.
What I would need is some kind of associative array that maps strings to
types, but as far as I know that's not possible, specially since the
strings would be runtime values.
--
/Jacob Carlborg