Subject: Re: [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Mika Heiskanen (mika.heiskanen_at_[hidden])
Date: 2008-12-21 08:35:02
Peter Simons wrote:
> Hi Mika,
> > I would prefer my word processor to announce a programming error
> > instead of producing a core dump. Am I missing some finer point on
> > the nature of invariants?
> apparently, you expect invariants to fail. They won't. Invariants never,
> ever fail. They are invariant. These assumptions are the cornerstones on
> which your algorithms are built. Adding code that throws an exception in
> case of an invariant failure is wasted, because that exception will never
> be thrown.
No, I do not except them to fail. However, it is possible that they fail
due to programming errors, and I would be naive to assume none would make
it to release versions. For example, I cannot let my server crash
if it cannot fulfill a particular type of request due to a programming error.
Instead it should log the error and fail that particular request. Clearly
the matter should have been resolved in advance by sufficient testing, but
is any amount of testing really ever sufficient?
I guess the problem is that I believe invariant failures may be recoverable,
but it does not seem to be the concensus. Perhaps I am thinking too much
about servers which must not crash.
--> Mika Heiskanen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk