This package is not currently loadable. The package owner has been contacted to assist in correcting this. (klc, 7/11/2008)
MiniTraits is a small implementation of Traits functionality. It enables you to create a set of behavior and state that can be reused by other classes in a way that is orthogonal to the normal class hierarchy.
Here's how MiniTraits work:
To create a new trait, simply subclass MtTrait and add whatever methods (instance and/or class side) or instance variables that you like. Then, you can add the behavior of your new trait to other classes in the system with the following expression:
SomeClass addTrait: MyTrait
You can remove a trait using #removeTrait: or #removeTrait:ifAbsent:. You can ask a class what traits it is using with the message #traits. All methods inherited from a trait will be placed in method categories that are prefixed with the trait name. This helps distinguish methods inherited from a trait from normal methods.
When you add or remove methods in a trait class, any other classes that are currently using the trait will be affected. If a method is added to the trait, it will be added to the classes using it (but only if that class doesn't already implement that selector). Similarly if you remove a method from a trait, any classes using that trait will also have that selector removed (but only if the selector was added by the trait).
Removing or redefining a selector that is inherited from a trait will cause a confirmation dialog to pop up. You will be asked whether you would like to make the change in the trait, or just for the class itself. When removing a selector that is overriding (shadowing) a selector of the same name in an inherited trait, the inherited version of the method will be installed in the class.
The net effect is very similar to inheritance.
Several extensive SUnit tests are provided to ensure the proper functioning of this package.