Smart method resolution for multiple inheritance
Current method resolution is trivial: if method is present in object then use it. Otherwise scan all object's hierarchy for that method. If method with the same name is found in more than one parent class exception is thrown. This approach makes hard to write mix-in classes. For example suppose class Base has methods foo(), class MixIn extends Base and overrides foo(), class C extends Base and MixIn. If one try to invoke C::foo() exception will be throw as current algorithm will find Base::foo() and MixIn::foo(). But Base::foo() should not be taken in account because it was the common base for all foo() implementations and MixIn::foo() can be safely used because it extends Base::foo() functionality (typically by calling base class method Base::foo() as part of its implementation). It is proposed to change resolution algorithm to detect common base methods that are find on different inheritance path and exclude them from result method list
Blueprint information
- Status:
- Complete
- Approver:
- ruhe
- Priority:
- Low
- Drafter:
- Stan Lagun
- Direction:
- Approved
- Assignee:
- Stan Lagun
- Definition:
- Approved
- Series goal:
- Accepted for juno
- Implementation:
- Implemented
- Milestone target:
- 2014.2
- Started by
- Stan Lagun
- Completed by
- ruhe
Related branches
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Improve method resolution rules for multiple inheritance