"Timon Gehr" <timon.g...@gmx.ch> wrote in message news:iukoge$u82$1...@digitalmars.com... > How would you catch it? I am sure it cannot be caught trivially: > > There are 4 possibilities: > 1. Both parent and child contract would pass. > 2. Parent passes, child would fail. > 3. Parent fails, child passes. > 4. Parent fails, child fails. > In case 2, the contract is invalid.
In reality, the overriding graph forms a tree, and the contract is invalid if any precondition passes if its parent's precondition fails. (the root being the most derived function) It is definately possible to implement runtime checking to enforce this.