From: matz@... (Yukihiro Matsumoto) Date: 2003-11-20T04:05:07+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) Hi, In message "Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types)" on 03/11/20, "Sean O'Dell" writes: |A contract is any interface, and a Ruby class is an interface. True, a Ruby |class isn't the definition of a contract, but any OO class serves the |function well enough. Despite Ruby's flexibility, at any given point, a |class implements an interface. It can be extended or changed, but it |definitely describes an interface. A class has interface; a class can be used as interface (by set of its methods); but it should not be checked by kind_of? or anything based on inheritance, just because it hinders flexibility of dynamic typing so much; remember StringIO or tempfile examples. |It's just informational. It's just for the purpose of speeding up development |and making the code a little more robust through a good report of what is |going wrong when someone passes in an object that can't be used by the |method. It doesn't prove that an object correctly implements an interface, |and the object can definitely break the interface, but the facility would be |there for programmers who can make use of it. For those that tend to break |interfaces when programming rather than use them properly, there are always |QA jobs. =) I admit type checking can gain you something, at the cost of flexibility, which I don't want to pay in Ruby. If you prefer static typing to dynamic typing, it's OK, there so many statically typed languages out there. Go ahead. matz.