The OpenD Programming Language

Contract Programming

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:

  1. a consistent look and feel for the contracts
  2. tool support
  3. the implementation can generate better code using information gathered from the contracts
  4. easier management and enforcement of contracts
  5. handling of contract inheritance

$(HTMLTAG3V img, src="images/d4.gif" style="max-width:100%" alt="Contracts make D bug resistant" border="0")

Assert Contract

See expression, AssertExpression.

Pre and Post Contracts

See:

Invariants

See Struct Invariants and Class Invariants.

References

template-mixin, Template Mixins, version, Conditional Compilation