On Sunday, October 09, 2016 14:06:42 Antonio Corbi via Digitalmars-d-learn 
> I think that the compiler assumes that its empty contract is always true.

That's exactly what it does. Having no contract is considered to be
equivalent to having an empty contract. So, because an empty contract will
never fail, not having an in contract in the base class (or interface)
function is equivalent to not having any in contracts anywhere in the
inheritance chain, which is pretty annoying. The ||ing and &&ing done with
in and out contracts and inheritance is critical to having contracts work
correctly with inheritance. And in contracts work properly when each level
declares one, but it probably would be better if having an in contract were
illegal if the base class didn't have one, since then you'd at least avoid
accidentally having an in contract that's pointless. out contracts shouldn't
have any of these problems though, since they're &&ed, and &&ing with true
doesn't change anything. Missing in contracts definitely is an easy way to
introduce bugs into your contracts though.

- Jonathan M Davis

Reply via email to