Shortcut evaluation for hierarchy of in contracts

Daniel Murphy yebblies at nospamgmail.com
Fri Jul 1 08:22:35 PDT 2011


"Timon Gehr" <timon.gehr at gmx.ch> wrote in message 
news:iukoge$u82$1 at 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. 




More information about the Digitalmars-d mailing list