Smart method resolution for multiple inheritance

Registered by Stan Lagun

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:
Ruslan Kamaldinov
Priority:
Low
Drafter:
Stan Lagun
Direction:
Approved
Assignee:
Stan Lagun
Definition:
Approved
Series goal:
Accepted for juno
Implementation:
Implemented
Milestone target:
milestone icon 2014.2
Started by
Stan Lagun
Completed by
Ruslan Kamaldinov

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/for,n,z

Addressed by: https://review.openstack.org/98577
    Improve method resolution rules for multiple inheritance

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.