[Squeak-fr] Ruby et les Traits.

Bergel, Alexandre bergel at iam.unibe.ch
Tue Oct 23 15:37:20 UTC 2007


Hi Andreas,

Ruby modules are mixins. The only way to compose mixins is inheritance.
With traits, you have different operators to do some fine tuning.

Cheers,
Alexandre


On 22 Oct 2007, at 16:37, Andreas Raab wrote:

> Out of curiosity, what is the difference between Ruby's modules and  
> traits? They strike me as extremely similar, but not being the  
> local Ruby guru I might overlook some implications. As far as I  
> understand it both allow "grouping of methods" (aka: include  
> statements) and both disallow state (in Ruby's case simply because  
> state access is always a dynamic attribute lookup). So what's the  
> difference?
>
> Cheers,
>   - Andreas
>
> stephane ducasse wrote:
>>> Quelques propos (récents) de matz (Yukihiro Matsumoto) à propos
>>> des Traits :
>>>
>>> - "Too bad I didn't know about traits when I designed Ruby."
>>>
>>> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/274227
>>>
>>> - "If I knew traits before designing Ruby, I'd have chosen traits  
>>> over
>>> modules.  But that's the life."
>>>
>>> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/274242
>> this is why I will try to find some times to polish traits in squeak
>> stef
>
>

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






More information about the Squeak-dev mailing list