I have a number of atomic classes (Components / Mixins, not quite sure what to call them) in the library that I am developing that are designed to subclass applications. This atomicity was created in such a way that applications can only use the functions that they need and combine components through multiple inheritance.
However, sometimes this atomicity cannot be ensured, because some component may depend on another. For example, imagine that I have a component that gives a graphical representation of an object, and another component that uses this graphical representation to perform some kind of collision check. The former is purely atomic, but the latter requires that the current object already subclasses this component of the graphical representation so that its methods are accessible to it. This is a problem because we need to somehow tell the users of this library that in order to use a particular component, they must also subclass this other. We could make this subcomponent of the collision component a visual component, but if the user also subclasses this visual component, it will not work because the class is not at the same level (as opposed to the simple diamond ratio, which is desirable) and give critical meta errors class that is difficult for a programmer to understand.
So I would like to know if there is any cool way, perhaps redefining a metaclass or using class decorators to mark these non-atomic components, and when they are subclassed, an additional dependency will be introduced into the current object, if it is not already there. Example:
class AtomicComponent(object): pass @depends(AtomicComponent)
Can someone tell me how I can do this? or if possible ...
edit: Since it is debatable that a meta-class solution is the best choice, I will leave it unacceptable for 2 days.
Other solutions may be to improve error messages, for example, running something like UserClass2 will result in an error stating that UnAtomicComponent is already extending this component. This, however, creates a problem that it is not possible to use two UnAtomicComponents, given that they will subclass the object at different levels.