Trait Composition

The Trait composition mechanism is an alternative to multiple or mixin inheritance in which the composer has full control over the trait composition. It enables more reuse than single inheritance without introducing the drawbacks of multiple or mixin inheritance.

Mix In

~

TLEYE, Sebastián, [no date]. Improving the implementation of traits in Pharo. . P. 70. Traits are a new concept in Object-Oriented Programming, they were included in programming languages such as PHP, Perl and Pharo/Smalltalk. Traits are pure units of behavior that can be composed to form classes or other traits. The trait composition mechanism is an alternative to multiple or mixin inheritance in which the composer has full control over the trait composition. The result enables more reuse than single inheritance without introducing the drawbacks of multiple or mixin inheritance. Pharo is a new open-source Smalltalk-inspired programming language and environment. It provides a platform for innovative development both in industry and research. Traits are integrated in Pharo but barely used due to a lack of support in the development environment. For this reason, it is necessary to create more support to programmers when using traits. Making classes and traits polymorphic is a good start. All the tools that know how to handle classes will also know how to handle traits. Achieve the maximum possible polymorphism between classes and traits is one of the goals of this work. Fix bugs in Pharo is also part of this work. There are bugs in Pharo presents since the first implementations of traits. We will fix these bugs and we will explain why they are important. Finally, we will think a new way to visualize traits, and with this, open doors to future programmers to implement it.