[Newbies] How to squeeze Multiple Inheritance into Squeak ?

Patty Gadegast peppermint-p at web.de
Wed Nov 15 13:50:58 UTC 2006


Hi Warakorn,

maybe it is a little bit late now, for a nice answer, but I will do it 
anyway.

You want multiple inheritance? Why? Usually multiple inheritance is not 
necessary at all.

Objects communicate via messages, and we have only objects in Squeak! In 
my mind the only idea behind having inheritance is, you don't want to 
code the same things again and again. So you can create generic objects 
that implement the functionalities, several Objects might use. I think 
that's clear. I red that your object should understand all the messages 
a "human-object" understands and a "ninja-object understands", ok, thats 
fine. Now I have 2 suggestions:
1. Isn't a ninja object a kind of human object, (if you use your common 
sense, don't think only in terms of your program, please). So you could 
inherit the ninja class (object) from the human class. Your new object 
would be inherited from this ninja class, which is a human class and 
would understand all messages, both do understand. But ok, this 
structure is static.
2. You could just teach your object to understand the same messages like 
a ninja class, if you would just implement this messages in your object. 
But again, this is a static structure.

And here is a third one, that maybe you had in mind. I provides a 
dynamic structure. Imagine you would bundle the messages that ninja 
objects understand, and you could add this bundle to your object, which 
is a human inheritance. I think this is done using traits. I know that 
there are traits in squeak or at least some people work on this, but I 
don't know how you use this things. There are other people that might be 
able to answer this "how" question. I am more on asking the what 
question, what exactly do you want to do (the purpose, not the means)?

Best regards,

Patty

Warakorn Paphrawat schrieb:
> Squeak does not support multiple inheritance.
>
> Sadly enough the possibility of Multiple Inheritance in Squeak would 
> greatly benefit me in my current Squeak project ?
>
> What would you suggest to squeeze some sort of Multiple Inheritance 
> into Squeak ?
>
> - C-like Macros / or some kind of automation
> - Traits
> - some other possibilities
>
> What is your experience ?
>
>
> The idea to design my system better and introduce more abstraction is 
> valid, but  I still would like to stick Multiple Inheritance.
>
> ------------------------------------------------------------------------
> Want to start your own business? Learn how on Yahoo! Small Business. 
> <http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/r-index> 
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>   



More information about the Beginners mailing list