-
Notifications
You must be signed in to change notification settings - Fork 119
Description
One of the main problems LHCb users have been facing when using DD4hep is the concept of Handles and its oddities compared to 'standard' C++ objects. Just to cite a few :
- passing handles as reference is a recipe for disaster while it's the recommended way for all other C++ objects. You should know you have to copy them.
- handles should not have members, although the code should be there, kind of breaks the object orientation concept
- handles are not inheriting from each other, even though the underlying objects do
This last point is the most problematic of all, and creates a lot of troubles. in particular it breaks the whole idea of virtuality at the base of many C++ constructs. Think of a simple vector<Handles>, hosting obviously Handles on different types all inheriting from the same base. It just does not work !
This also has another bad consequence when implementing the code of a pair MyObject/MyElement=Handle<MyObject> : you basically need to have all the code in MyObject and then replicate all signatures in the Handle. I known the theory is that the code should be in the Handle, but that actually quickly fails as soon as some functions are calling each other, since the object has no possibility to call a function on the Handle. Net result is that all our Handles are pure facade, not really needed and only creating troubles.