From: Hugh Sasse Staff Elec Eng Date: 2001-07-12T19:36:28+09:00 Subject: [ruby-talk:17708] Re: Old chestnut: invariants, pre/post conditions and so on On Thu, 12 Jul 2001, Andrew Hunt wrote: > I started on an implementation of Design by Contract for Ruby > last year; it's listed in RAA (and is on the pragmaticprogrammer.com I know of this one... > web site). It was just a proof of concept bit of playing around, but which is why I was hoping to stimulate more interest or give you other pointers to possible resources on this. > it seemed to work mostly okay. So it might be more stable than I thought. I'll take a proper look when I get a bit more time. > > It's not "particularly difficult" to implement DBC for a dynamic > language, but it is a bit different. In the end, I think it's > actually easier. Then I did remember wrongly, or the twists in *my* brain denatured this! > > Eiffel, for example, must know *all* of the static types and their > relationships when compiling in order to get the DBC stuff right. > In Ruby (and Smalltalk, etc.), we don't care about the types -- only > the semantics of behavior. If an object honors the pre/post/invariant, > that's great: we don't care about it's "type", only its semantics. > > In my twisted little brain, I think DBC is actually far more valuable > in a dynamic language than in a static language. YMMV. I think it would be valuable too, but cannot comment on the *relative* merits. > > /\ndy > Hugh