Eivind Eklund
2/16/2006 6:21:00 PM
On 2/16/06, Edgardo Hames <ehames@gmail.com> wrote:
> On 2/16/06, Jens Auer <jens.auer-news@betaversion.net> wrote:
> >
> > 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.
>
> I assume that "automatically checked" means checking the contracts at
> compile time.
> That's an undecidible problem.
Yup, so that's not what Eiffel compilers do. Instead, they administer
the execution of run time checks. Eiffel use trickery to ensure that
you only program cases that ARE decideable, too: Loop invariants are
checked by having a block that has to return asmaller value for each
iteration of the loop. Fortunately, many many invariants *can* be
specified in a useful way, even if there are some cases that can't.
Also, technically, isn't that only undecidable if you assume an
infinite size Turing machine, while a finite size computer IS
decidable, it's just impractical? At least as long as you actually
can formally specify the invariant?
Eivind.