From: Matthew Harris Date: 2006-06-15T20:57:55+09:00 Subject: Re: Does each over an array bring a counter/index with it? Ruby's Comparable module vs. Java's Comparable interface. Ruby: (http://ruby-doc.org/core/classes/Comparable.html) Java: (http://java.sun.com/j2se/1.3/docs/api/java/lang/Comparable.html) Notice the `compareTo()' method in Java's Comparable is equivalent to the `<=>' method which Ruby's Comparable module requires to be defined. This is how interfaces and mix-ins work. Ruby's mix-ins are closer to interfaces than they are inheritance. Inheritence implies subclassing, most of the time. On 6/15/06, Dick Davies wrote: > On 15/06/06, Matthew Harris wrote: > > > No, it's a mixin (a bit like OOP inheritance in other languages). > > > > You mean a bit like interfaces. > > Not really. Interfaces don't specify an implementation. -- Matt