From: Florian Gross Date: 2005-02-17T06:19:50+09:00 Subject: Re: DesignByContract (was RE: utilizing ++ and -- for comments) Pe�a, Botp wrote: > at [mailto:"neo.matrix.fr(at)"@wanadoo.fr] wrote: > > // > The closest connection bw code and comments I can think of > //is (eiffel's) > pre/post condition.. if fully agree with you > //and I believe at 100% in pre/post conditions, > //class invariant, check clause... and in general in Design By Contract > // > //it answers well at the question : Who do what ? With wich > //garanties ? == The *most* important question to solve the > //issue of the quality of > //software == > > if memory serves me right (my mem misses many times :), I think Andy Hunt > started implementing something like this. I searched in raa but (sadly) > cannot find one though :( Yup, it's a bit out-dated, though. I'll have a look at integrating Eiffel-style DBC (pre and post-checks plus invariants) with ruby-contract (see http://ruby-contract.rubyforge.org/) based on Andy's code soon, though. I think I'll use an interface like this: class MyArray def pop() ... end check :pop, :pre do size > 0 end check :pop, :post do # couldn't think of a better sample here size >= 0 end check :invariant do size >= 0 end end I'm not sure about using "check" though -- I think that is to close to type / signature checking which I already have implemented. If any of you happens to have any alternative suggestions, feel free to share them!