Fwd: [Squeak-fr] Ruby et les Traits.
Ramon Leon
ramon.leon at allresnet.com
Mon Oct 22 20:51:11 UTC 2007
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On
> Behalf Of Andreas Raab
> Sent: Monday, October 22, 2007 1:37 PM
> To: The general-purpose Squeak developers list
> Subject: Re: Fwd: [Squeak-fr] Ruby et les Traits.
>
> 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
Traits can be composed better because you can specify which methods you want
from conflicting traits explicitly. Ruby's modules I believe don't allow
you to mix and match, but is based on inclusion order only. Other than
that, I think they're the same.
Ramon Leon
http://onsmalltalk.com
More information about the Squeak-dev
mailing list
|