Il 12/04/2012 18:52, Andreas Färber ha scritto: >> Selecting the type of an object should be done by having a link<> >> property and letting the user create an object and setup the link. > > No, that's not what a link does. A link<> property lets the user > associate one instance, not a type that can be used for multiple > instances. We'd need a template<> or clone<> mechanism for that! > > For example, the user specifies -cpu cortex-a9,+neon,-fpu and we have a > dual-core exynos4210 SoC. > > I originally had a patch on my qom-cpu-sh4 v1 series where exactly such > a link got criticized by Peter: > > http://patchwork.ozlabs.org/patch/146669/ > > And I agree, it was an ugly workaround around the missing two-stage > constructor support. Therefore I had posted my object_realize() series!
I think this is difficult to reconcile for now. I can see Anthony's point, which makes a lot of sense from the PC point of view, but then "magic" configuration can also be important when working with SoC boards. I've added a missing_property hook to my series that can be used to this end. Accessing a property can trigger creation of the device with the appropriate class before realization. Paolo