WTF is a trait?

Nevin Pratt nevin at bountifulbaby.com
Sat Sep 3 18:38:07 UTC 2005


Daniel Salama wrote:

> I would say they are more like "include" in Ruby. With Java  
> interfaces, you still need to code the implementation of the methods,  
> whereas with Traits, you are incorporating the functionality of those  
> methods. Sort of like "including" a library of methods.
>
> - Daniel
>

What are the keywords 'self' and 'super' bound to for a trait?

It sounds like traits are (conceptually) a method for ad-hoc composing 
the MethodDictionary contents of a class.  If that is true (is it?), 
then it sounds like that once a trait is bound within a class, then 
'self' and 'super' have their usual meanings within that class.

Nevin





More information about the Squeak-dev mailing list