design by contract versus doctest

Daniel Dittmar daniel.dittmar at sap.com
Tue Apr 6 11:00:04 EDT 2004


Yermat wrote:
> Colin Blackburn wrote:
>> It doesn't work exactly as in Eiffel. In Eiffel it is *part* of the
>> language. Some aspects of DbC can be implemented in other languages
>> but not all (invariants for instance are not straightforward.)
>
> It does work exactly the same in effect even if the syntax is not the
> same. But we're both right.

- in Eiffel, postconditions of methods are inherited (because subclasses
must guarantee at least as much). This is difficult to implement with a
simple assert statement.

- postconditions have access to the values parameters and instance variables
had upon entry to the method. This is difficult to support even in a
compiler that knows about these things, at least for mutable objects.

Daniel





More information about the Python-list mailing list