Invariant and pre/post-conditions order
Walter Bright
newshound2 at digitalmars.com
Thu Jan 19 19:31:08 PST 2012
On 1/19/2012 6:37 PM, Steven Schveighoffer wrote:
> I have to disagree on some level with (1). It might not make a difference in
> determining there is a bug, but it makes a difference because failing in the
> out-condition gives you more information, even if the invariant is broken. It
> tells you which function broke the invariant.
No, it doesn't give you more information in the out condition. Furthermore, the
postcondition and the invariant check entirely different state - the return
value is not the same thing at all as the instance state. There's no reason to
believe that one is superior to the other, nor that they are redundant.
More information about the Digitalmars-d
mailing list