Hi; in the QOM model, are you supposed to be able to cast from an interface class to the concrete class that is implementing it?
To give a specific example, if I have a ResettableClass *rc should I be able to do DeviceClass *dc = DEVICE_CLASS(rc); (assuming that the rc I have is actually from a DeviceClass) ? If I'm reading the code correctly, at the moment this isn't possible: object_class_dynamic_cast() has code for "if the class we're casting from implements interfaces and the class we're casting to is an interface, then look through the list of interfaces to see if we should be returning the class pointer from the interface list", which means you can cast from the concrete class to the interface class. But there's no code there to say "if the class we're casting from is an interface, try the concrete class". As far as I can see we do actually record the information we need to do this -- InterfaceClass has a field concrete_class that points to the concrete class that's implementing it. But this field is currently only written, never read. Should we: (a) support casting from the interface class back to the concrete class, by adding some extra code in object_class_dynamic_cast(), or (b) decide that that isn't something we should be wanting to do, and remove the dead concrete_class struct field ? (The thing I was trying to do when I ran into this was effectively to add a class method, as opposed to an object method, to an interface class. Specifically, the only reason that the ResettableClass::get_transitional_function takes an Object* is so that it can do an object-to-class cast to get to the class pointer for the concrete class, and I had somewhere where I wanted to also call that function where I only had the ResettableClass *rc, not a specific object.) thanks -- PMM