Shortcut evaluation for hierarchy of in contracts

Simen Kjaeraas simen.kjaras at gmail.com
Fri Jul 1 09:32:34 PDT 2011


On Fri, 01 Jul 2011 18:24:08 +0200, Timon Gehr <timon.gehr at gmx.ch> wrote:

> The child's contract says: If my parent's contract failed, I can still  
> satisfy the
> postcondition, if this _alternative_ precondition holds. But it does not
> necessarily have to pass on all input the parent passes on, because it  
> does not
> even get checked if the parent's precondition holds.
>
> If you add such a check, the child's in-contract will have to carefully  
> duplicate
> the parent's precondition in order not to provoke a nonsensical  
> runtime-error.
> Adding such a check would make D's contracts unusable in anything but  
> the most
> trivial cases.
>
> (Analogously, the child's 'out'-contract does not have to re-check the  
> parent's
> postcondition.)
>
> 'Capiche?' ;)

Absolutely. I was in the process of answering your other post where you
outlined this. Believe me, I'm on your side now. :p


-- 
   Simen


More information about the Digitalmars-d mailing list