WTF is a trait?

stéphane ducasse ducasse at iam.unibe.ch
Sat Sep 3 20:42:36 UTC 2005


self and super with a trait have exactly the same semantics than  
within a class.
A trait is not a run-time entity, just a first class method category.

Stef

On 3 sept. 05, at 20:38, Nevin Pratt wrote:

> 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