Eiffel like reports for Design by Contract contracts
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Fri Jul 25 14:07:31 UTC 2025
Some notes:
1. The ``Identifier :`` syntax is used for labels within a statement list.
2. The feature in question you are asking about is assertion clauses. D
does not have this.
https://www.eiffel.org/doc/solutions/Design_by_Contract_and_Assertions
https://www.eiffel.org/doc/eiffel/Eiffel_programming_language_syntax#Assertions
3. Eiffel requires assertion clauses in the in condition (with the tag),
but not in the out contract.
4. Instead of introducing new syntax specific to this task, I would
suggest introduce having UDA's on statements. ``@AssertClause("more than
zero") { ... }``
5. We support the class inheritance behavior of contracts. Right now
this is butting heads against our exception handling behavior and is
preventing us from making certain changes (that are not necessarily better).
6. The current behavior of contracts, when they get compiled in and
executed isn't what is expected currently. This needs fixing.
7. Its unlikely the behavior of interfaces wrt. method behavior (such as
no default body) is going to align with what you expect. Again, I want
to resolve this but it isn't on my short term list.
If you come up with a concrete set of changes, then you would post it on
the ideas forum as a starting point.
Classes in general are on my list of things that need work, but my
attention is elsewhere and that lot of work is waiting on other work
done by other people to both start and finish. Specifically related to
TypeInfo removal.
More information about the Digitalmars-d-learn
mailing list