WTF is a trait?
Daniel Salama
dsalama at user.net
Sat Sep 3 19:01:04 UTC 2005
From the little I know, the methods you include from a Trait become
methods of the class. Therefore, self and super refer to the same
self and super you would refer to if you were to write a method in
that class.
- Daniel
On Sep 3, 2005, at 2:38 PM, 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
|