Shortcut evaluation for hierarchy of in contracts

Jesse Phillips jessekphillips+D at gmail.com
Fri Jul 1 10:05:27 PDT 2011


Daniel Murphy Wrote:

> I disagree.  If the child's in condition requires something that the 
> parent's didn't, you've just tightened the precondition.
> 
> If I understand correctly, it's equivilent to:
> parent: require a is greater than 0
> child: require b is greater than 0
> 
> In this case, the parent allows more values of b than the child does, so the 
> precondition has been tightened.

No, in this case the child has allowed more values of 'a' then the parent. If the parent fails the child will check and say things are ok because 'b' is greater than 0.


More information about the Digitalmars-d mailing list