Shortcut evaluation for hierarchy of in contracts

Daniel Murphy yebblies at nospamgmail.com
Fri Jul 1 06:53:41 PDT 2011


"Walter Bright" <newshound2 at digitalmars.com> wrote in message 
news:iuju03$27ip$1 at digitalmars.com...
> The 'in' contract must pass at least one of the 'in' contracts of its 
> inheritance hierarchy.
> Derived functions "loosen" the requirements for input.

This might be the recommended way to do it, but this is not enforced by the 
compiler, just assumed.

To enforce this, the compiler should give an error if a base function's 
precondition passes but a derived precondition does not.

The requirement is not really that any 'in' contract passing is good enough, 
it's just assumed that all preconditions on inherited functions will pass if 
the base contract does. 




More information about the Digitalmars-d mailing list