Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.
Contracts enable specifying conditions that must hold true when the flow of runtime execution reaches the contract. If a contract is not true, then the program is assumed to have entered an undefined state.
Building contract support into the language provides:
- a consistent look and feel for the contracts
- tool support
- the implementation can generate better code using information gathered from the contracts
- easier management and enforcement of contracts
- handling of contract inheritance
Pre and Post Contracts
See Struct Invariants and Class Invariants.
Copyright © 1999-2023 by the D Language Foundation | Page generated by Ddoc on Tue May 30 07:35:27 2023