On 7/1/2011 1:10 AM, Jens Mueller wrote:
Yes. But the problem with passing only one of the in contracts is that it is error-prone because it *assumes* that for in contracts the requirements are widened. But what if the programmer fails at loosening a derived in contract, i.e. he restricted it. In the current setting the programmer won't know that he did an error. And with deep inheritance hierarchies it gets more complicated to have all the contracts of super classes in mind. Why not check all in contracts to make sure that they follow the loosening rule? Why not enforce the loosing rule?
The loosening rule is that one of the in contracts must pass. That's exactly what it does. As soon as one passes, there is no need to check the rest.