[Newbies] Demystifying "most Smalltalk’s don't directly support multiple inheritance"
Klaus D. Witzel
klaus.witzel at cobss.com
Thu Jun 22 22:20:49 UTC 2006
haven't you heard that Smalltalk and Squeak do not directly support
multiple inheritance, time and again? But that Perl, Python and Ruby do
(to some extent)?
Well, that is not the case for Smalltalk since the time that VMs are
implemented by using the specs of the Blue Book.
I have attached a small .st file which demonstrates that the *unchanged*
VM *must* support multiple inheritance (for message sends), or else it
won't work properly. It's a matter of view on what the VM does for you :-D
With the exception of support code for exceptions [pun intended] the
attached examples work on VMs which implement the super send from the Blue
The first example demonstrates that multiple inheritance works; in this
example it is also checked that the requesting method qualifies (that the
instances qualify is checked at fileIn time).
The second example does a message tally and shows that there is less than
50% overhead when possible walkbacks are guarded at every multiple
inheritance message send.
The third example employs the existing method cache of the VM (the
original Squeak VM) for multiple inheritance message sends and thus
minimizes the overhead to less than 5% (and the demo is written in .st
Again, this all exists *unchanged* for decades. It only had to be brought
to the surface?
I would be very interested to see if my examples run on other platforms
and VMs, please post your experience. Thank you.
It'd be equally interesting if the approach had been used before.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 8901 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20060623/a495f816/Multiple-Inheritance-0001.obj
More information about the Beginners