ページの改善
いますぐフォークしてオンライン編集し、このページのプルリクエストを送信します。 Github へのログインが必要です。 これは小さな変更に適しています。 大きな変更を加えたい場合は、通常の cloneの使用をお勧めします。
日本語版について
個人的な学習のために、dlang.orgを翻訳したサイトです。 翻訳に際して、様々なサイトを参考にしています。

契約プログラミング

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
Contracts make D bug resistant

Assert 契約

See AssertExpression.

事前、事後契約

See contracts.

不変条件

See Struct Invariants and Class Invariants.

参考文献

ミックスイン[Template Mixins]
条件コンパイル[Conditional Compilation]