From: Harry Ohlsen Date: 2003-09-19T12:28:11+09:00 Subject: Re: Ruby and "old"? Hi Chris, Chris Dutton wrote: > I'm just curious as to whether or not there's an eqivalent to an interesting > capability from Eiffel. What I'd like to be able to do is something like > the following extremely trivial and self-explanatory example: > > def decrement(n) > n -= 1 > raise "Whoopsie..." if n != (old n) - 1 > end I'm fairly certain that one of the prag progs (Dave Thomas or Andy Hunt) wrote a Design By Contract library at one stage that had that capability. Let me do a quick search ... yes, here's a link: http://www.pragmaticprogrammer.com/ruby/downloads/dbc.html Note that it's quite old, and it doesn't look like it's been worked on for about 18 months and was obviously targeted at 1.6.8, but might still work with 1.8.0. Cheers, Harry O. -------------------------------------------- Computers are like air conditioners ... they stop working properly if you open WINDOWS!