Boost logo

Boost :

Subject: Re: [boost] [Boost-users] [review][constrained_value] Review of Constrained Value Library begins today
From: David Abrahams (dave_at_[hidden])
Date: 2008-12-21 03:08:21


on Sat Dec 20 2008, Mika Heiskanen <mika.heiskanen-AT-fmi.fi> wrote:

> David Abrahams wrote:
>
>> Exceptions should almost never be used in response to broken invariants.
>
> Pardon my ignorance, but how come? The constraints I have to validate usually
> concern broken user input

That's not a broken invariant. A broken invariant means your program is
broken.

> via the command line or a query string. How should I deal with them if
> not with exceptions? Or to be more precise, why should I not use
> constrained types for validating user input if it saves me a lot of
> if-statements in the long run?

I would never argue that you shouldn't do that.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk