Multiple Inheritance without MixIns
This work is based on Maurice Codik’s start from last year. I spent some hours on it today and I am willing to release it to the public. The basic implementation idea didn’t change, but I had to change some strategies in order to implement a reasonable method resolution order. This may also mean, that the performance of message sends suffers from these changes. So this library is not meant to work in public software, but it may be used to fool around and see what is possible.
My main targets where a reasonable method resolution order (namely Python-2.3’s) and the functionality of the main meta object and reflection protocol of ruby (see this post for some examples).
Download
You may download the library in its very first version (0.1) here. The RSpec file is available separately.
Update: The code is now available on GitHub.
Specification
I have used Rspec to state my wishes.
Assuming, that A
and
B
are direct subclasses of Object
A subclass of A
and B
- should answer with
[A, B]
when sendedsuperclasses
- should not list constants defined in its superclasses, when sent
constants
- should not answer
true
toconst_defined?
for constants defined inA
orB
- should answer
true
toconst_defined?
for constants defined in it - should list methods of its superclasses in
instance_methods( true )
The Ancestors of a subclass of A
and B
- should contain
A
,B
andObject
- should have
A
as first element - should not include double entries
- should contain
A
beforeB
- should contain
B
beforeObject
An instance of a subclass of A
and B
- should be kind of its class
- should be kind of its super classes
- should be kind of its super super classes
- should prefer its own methods over inherited ones
- should be able to call inherited methods
- should be able to combine inherited calls
- should prefer methods defined in
A
overObject
’s - should prefer methods defined in
B
overObject
’s - should prefer methods defined in
A
overB
’s (left first) - should be able to use
method_missing
- should be able to use
method_missing
in one of its parents - should answer
respond_to?( 'some method in A' )
withtrue
- should answer
respond_to?( 'some method in B' )
withtrue
- should answer
respond_to?( 'some method in Object' )
withtrue
- should be able to access constants defined in superclasses directly
- should be able to use
const_missing
- should list methods of its superclasses in
methods
- should be able to use methods from
A
andB
using own instance variables - should be able to use blocks for methods in superclasses
When A
and B
are subclassed by a class, they
- should be informed via
self.inherited( subclass )
I did not yet work on instance or class variables, as well as the behaviour of private or protected methods (who uses them anyway?). Please send me your ideas or bug reports. I am sure, that this is far from perfect.

My name is Gregor Schmidt. I am a freelance Ruby and JavaScript web developer based in Berlin, Germany. I do Ruby and Rails since 2005, JavaScript since 2006. I wrote my first Redmine plugin in 2007.
I mainly work with Rails, Backbone, and Bootstrap, but I am also good at picking up new frameworks, since I will probably know most of their concepts from other projects.
If your interested in more of my previous work have a look at my portfolio. I have also published my rates for everybody to see. I would love to hear, how I may help you.