Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Mika Heiskanen (mika.heiskanen_at_[hidden])
Date: 2008-12-21 07:59:21


Robert Kawulak wrote:

> There seems to be confusion between broken invariant and assignment of invalid
> value. The latter is handled by the error policy and it is its duty to prevent
> breaking the invariant. One of the ways to prevent it is throwing an exception,
> other ones are adjusting the value to be valid or ignoring the assignment. If
> the invariant gets broken, then it means there's something wrong either with
> your error policy, the constraint policy or the value type, because they do not
> fulfil the requirements of constrained class. So, as David has pointed out,
> broken invariant means that the programmer has done something wrong.

The confusion is all mine, I'm sure. However, I still do not see why a
programming error should not be handled by an exception if it is
possible. Of course some situations are so severe that the error is
unrecoverable, but is that really the most common case with *detectable*
programming errors?

Regards,

--> Mika Heiskanen


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net