From: gwtmp01@... Date: 2006-04-02T22:58:34+09:00 Subject: Re: Typed Parameters On Apr 2, 2006, at 9:29 AM, Austin Ziegler wrote: > On 4/2/06, Robert Dober wrote: >> My programs often pass objects of an unexpected "contract, behavior, >> type, mixin interface" you name it. I would like a modern language to >> help me, the *stupid* programmer to be more *effective* Ruby claims >> that. > > It's called "unit tests." If your programs are often passing objects > that don't behave the way you want those objects to behave, then > it's a > bug that you should be ensuring doesn't come out of the caller; in > Ruby > it's often far more efficient to ensure that the caller doesn't > screw up > instead of the callee doing checks ... If I remember correctly from _Object Oriented Software Engineering_, Betrand Meyer specifically talks about how when pre-conditions fail, it is the *caller* that has violated the contract. When a program is written correctly (i.e., without bugs) pre-condition testing is completely superfluous at run-time. I think the Eiffel compilers even have a switch to turn- off run-time pre-condition testing. I'd rather see the support for pre-conditions and testing within the context of the development environment rather than burdening the run- time environment. The use of annotations along with smart text editors and test-case generators might be useful. Gary Wright