Contract Programming - D Programming Language (original) (raw)
Contents
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.
Rationale:
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
Assert Contract
See AssertExpression.
Pre and Post Contracts
See:
Invariants
See Struct Invariants and Class Invariants.
References
Copyright © 1999-2025 by the D Language Foundation | Page generated byDdoc on Sat May 3 22:41:59 2025