Communicating between in and out contracts

Rainer Deyke rainerd at eldwood.com
Sat Oct 17 19:58:43 PDT 2009


Rainer Deyke wrote:
>  {
>    auto old_x = x;
>    try {
>      F();
>    } finally {
>      G(old_x);
>    }
>  }

Not 'finally', unless postconditions are checked when the function
terminates with an exception.  This is closer to correct:

 {
   auto old_x = x;
   // Preconditions go here.
   F(); // <-- function body
   G(old_x); // <-- postcondition
 }


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list