[squeak-dev] On traits composition

Colin Putney cputney at wiresong.ca
Tue Dec 8 18:58:50 UTC 2009

On 8-Dec-09, at 9:34 AM, Igor Stasenko wrote:
> Why?
> Can composition be an ordered collection of traits, so, they applied
> in sequencial order to class?
> Mixins use an inheritance chaining to achieve same effect.
> But traits don't using inheritance, and that's, i think, the main
> difference between them and mixins, but not the order of composition.

One of the defining features of Traits is that composition is  
commutative. The order doesn't matter because the composition of any  
two traits is an XOR operation on the methods that each Trait defines.  
Any method that is defined in both the Traits does not show up in the  

The fact that Traits don't use inheritance chaining is a consequence  
of this definition, not the defining feature its self.


More information about the Squeak-dev mailing list