----- Original Message -----
From: "Bryan Murphy" <bryan / terralab.com>


> Why doesn't Ruby have some sort of Contract/Interface specification (ala
> Java Interfaces or Eiffel Contracts)?  Is there a technical reason that
> these aren't possible, or is it just a subject that has not been
> properly approached yet?  I've seen lots of discussion about static
> types and responds_to? method, but I think both of these are really just
> one small aspect of the much larger problem: guaranteeing up front that
> the library user implements the required functionality.
>
> Bryan

Ruby's mixins have similar features to Java interfaces, but they are more
flexible, and don't play any specification role.  Also, Ruby classes don't need
any interface description to be able to plug-n-play; they just need to support
the rigth methods at the right time.

In short, it's not a technical reason.  Ruby doesn't want to be as strict as
Java.  Result: more flexibility, but no guarantees.

If you find yourself in a situation where you want these things, but also want
to use Ruby, either:
 - use Ruby as a prototype and then convert to Java if necessary
 - enforce type-compliance to key methods by raising exceptions

Gavin