From: "Weirich, James" Date: 2003-11-22T04:43:24+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) ) > It seems that you could only pre-assert that objects going in > had a certain range of values that fit the requirement. The > above example wouldn't work because it depends on the result > of a method call. In the usage I described, only preconditions should go into the :pre method. If I were to design a contract for your example, I would suggest ... def greet:post(other_person) if shake_hand(other_person) == not_clammy assert other_person.married? Assert_equal self, other_person.spouse assert_equal other_person, self.spouse end end In other words, our post condition is that if the other person has an acceptable handshake then we be hitched when the function is done executing. Note that I'm using precondition and postcondition in a technical sense defined by Design by Contract ideas. If you are not familiar with DbC, I can recommend "Object Oriented Software Construction" by Bertrand Meyer (a hefty read, but worthwhile), or one of Meyer's shorter papers available at eiffel.com. -- -- Jim Weirich / Compuware -- FWP Capture Services -- Phone: 859-386-8855