Polymorphic catcalls

Famous none at none.net
Sat Apr 21 04:41:13 PDT 2012


I think that Design by Contract is reasonable in theory and
practice. As far as I know, in contrast to Eiffel, D does not
allow covariant method arguments in subclasses. This is a
necessary condition for structural correctness of the object
oriented model. However, this condition is not sufficient. In
order to ensure correctness, a proof is necessary. Design by
Contract generally cannot provide a proof but only cover some
specific test cases. In practice, if done well, Design by
Contract often gives sufficient reason to trust a piece of code.
Particularly, I do not share your fear that, in practice, a
subtype 'inevitably' breaks a supertype's contract. On the
contrary, running into such a situation should make the developer
rethink his model.

Cheers,
Famous


More information about the Digitalmars-d mailing list