Help for beginners (was Re: Request for Comment: MethodAnnotations for 3.9alpha)

Daniel Vainsencher daniel.vainsencher at gmail.com
Sun Aug 28 19:31:52 UTC 2005


Lic. Edgar J. De Cleene wrote:
> Please I beg a clear "why us think ..." page somewhere.
> Why some members think inheritance is not enough ?
Take the example we've been discussing, ClassDescription. It is an 
abstract class. Why does it exist? to share behavior between Class and 
Metaclass. Why is this behavior not put in Behavior, which is already 
shared by those? because someone might want to inherit from Behavior, to 
create a runnable class, that does not have all this extra detail.

And what if we want a non-runnable class that has all the ClassDesc 
detail? that's tough, under single inheritance, we can't do that.

And why does the structure of Class, that any newbie might need to 
explore to understand the image he uses, have to be constrained by the 
structural considerations of expert wanting to subclass behavior? that's 
  the way inheritance works. It forces the inheritance, though some 
other design might be more understandable.

So traits give us a different mechanism, that allows to reuse stuff from 
any class, without forcing things so specifically. As an addition to 
inheritance, they do allow some new options. According to some, they 
might be a good replacement for inheritance.

Anyway, for more detail, read the papers in the trait papers page.

Daniel



More information about the Squeak-dev mailing list