Invariant and pre/post-conditions order
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jan 19 20:24:59 PST 2012
On Thursday, January 19, 2012 23:19:02 Steven Schveighoffer wrote:
> Imagine you have 1000 lines of code that call 50 or so
> different methods on a class. Any one of those calls in any one of those
> methods could cause an invariant failure. But only one method call can
> cause a specific out condition failure, and the lines of code that call
> that function might be significantly less than 1000 (maybe a handful).
Won't you be able to see exactly which function failed in the stack trace? Or
does it not show up, because the invariant is checked _after_ the function
call? I would still think that the stack trace would make it fairly clear even
if that's the case.
I don't really care whether the invariant is called first or the post-condition
is called first though. It just seems more logical to me that the invariant
would be called first.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list