From: John Carter Date: 2006-02-17T06:22:23+09:00 Subject: Re: OT: Is this worth a try? On Thu, 16 Feb 2006, Jens Auer wrote: >> You find run time bugs much faster that way. > Design by contract is a little bit more than placing asserts at the beginning > and end of a method. I would be realy glad if someone points me to some > library wich implements DbC completely in Ruby, eg the fact that a method can > only widen the supermethod's contracts which is automatically checked. http://www.rubycentral.com/downloads/dbc.html I don't think that does quite all you want, but I find I get 90% of the value I need out of static type checking, polymorhic type checking and DbC by very very simple roll you own oneliners.. class Boo def bah( goo) raise "Whinge" unless expression && goo.responds_to? :glue_it invariant #do stuff raise "Whinge" unless post_expression invariant # If I'm paranoid end def invariant raise "Moan" unless invariant_expression end end John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand Carter's Clarification of Murphy's Law. "Things only ever go right so that they may go more spectacularly wrong later." From this principle, all of life and physics may be deduced.