[Squeak-fr] Ruby et les Traits.
stephane ducasse
stephane.ducasse at free.fr
Tue Oct 23 15:07:34 UTC 2007
thanks for the pointer!
I should look at that.
Stef
On 23 oct. 07, at 10:01, Giovanni Corriga wrote:
> Il giorno mar, 23/10/2007 alle 07.02 +0200, Jason Johnson ha scritto:
>> But since these two systems are so similar what places are modules
>> used in Ruby to the best effect? I always used Haskell as my
>> comparison, but it turns out this isn't a good idea because Haskell
>> isn't an OO language, so the applicability is different.
>
> An example of module use in the Ruby standard library is the
> collections
> system. Ruby doesn't have an abstract Collection class that acts as
> the
> superclass for all collection classes, but it has an Enumerable module
> that implements methods such as #select, #collect, #inject, etc. All
> these methods depend on the including class implementing #each
> (#each is
> the Ruby equivalent of #do: ). All the concrete collection classes
> have
> an #each method and include Enumerable in order to support the
> complete
> collection protocol.
>
> Giovanni
>
>
>
More information about the Squeak-dev
mailing list
|