On Thu, 12 Jul 2001 00:09:53 +0900, Hugh Sasse Staff Elec Eng 
<hgs / dmu.ac.uk> wrote:
> Given the discussion in the past on Eiffel-like features
> for Ruby, I pass this on in the hope that it may stimulate something
> useful.  My memory of the discussion, which could be wrong, was
> that to provide these features for a dynamic language such as Ruby
> was particularly difficult.  When I saw this response to my saying
> this, I asked if I could post this to the list/group.  Richard agreed.

I started on an implementation of Design by Contract for Ruby
last year; it's listed in RAA (and is on the pragmaticprogrammer.com
web site).  It was just a proof of concept bit of playing around, but
it seemed to work mostly okay.

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.

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.

/\ndy