Subject: Re: [boost] Policy proposal: All user-visible exceptions should be thrown through BOOST_THROW_EXCEPTION [was RE: Boost and exceptions]
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2012-06-26 03:54:48
> I don't think creativity is being hindered too much in this case.
Creativity is lost in being able to find yet a better way to handle errors.
Of course, if someone came along with a better idea, we could always change
our policies yet again, so the creativity isn't completely lost.
But do note that it is in some way discouraging experimentation with error
handling. That may be a reasonable trade off, just be aware of it.
Sent from my portable Analytical Engine
*From:* "Pete Bartlett" <pete_at_[hidden]>
*To:* "boost_at_[hidden]" <boost_at_[hidden]>
*Sent:* 25 June, 2012 5:32 PM
*Subject:* [boost] Policy proposal: All user-visible exceptions should be
thrown through BOOST_THROW_EXCEPTION [was RE: Boost and exceptions]
> On 06/22/2012 02:23 PM, Stewart, Robert wrote:
>There is no Boost policy that requires Boost.Exception support. If you
think there should be, >then lobby for it.
This thread has pushed me in the direction that this is the way to go. Here
are some specific policy change proposals:
1) Mandate that all throws should be through BOOST_THROW_EXCEPTION and
enforce through Boost.Inspect. or:
2) Strongly suggest in developer documentation that they should be through
BOOST_THROW_EXCEPTION but drop short of mandating. or:
3) Better document and formalize existing practice (that user-visible
exceptions should derive from std::exception, and that a developer may use
BOOST_THROW_EXCEPTION and boost::throw_exception and may respect
BOOST_NO_EXCEPTIONS, but isn't obliged to do so)
Pros for 1) and 2):
- All libraries naturally support the BOOST_NO_EXCEPTIONS config without
further work on their part.
- All libraries benefit fully from Boost.Exception functionality.
- All libraries benefit from future improvements to Boost.Exception (e.g.
possible improvements relating to cross-thread exception handling)
Cons for 1) and 2):
- Always paying for the cost of #including
- All libraries are dependent on - and therefore become vulnerable to any
future breakages (if any) in - Boost.Exception.
Cons for 1)
- This would (a little) reduce the autonomy that Boost authors have to
implement as they see fit. Historically Boost authors have great individual
freedom and imposing restrictions may be unattractive to (volunteer) devs.
FWIW, I'm firmly in favour of 1). Re the cons, I don't think the cost of
extra includes will be the straw that breaks the camel's back, particularly
when users are already likely to be putting Boost in a PCH. Re the second
con, I think Boost should collectively be prepared to eat its own dogfood -
if Boost.Exception does ever break, users will be affected too and so any
breakages in Boost code will act as an early warning system when testing. Re
the third con, I think this is a fair point, but all we are really doing is
asking "throw e;" to be replaced by "BOOST_THROW_EXCEPTION(e);" so I don't
think creativity is being hindered too much in this case.
Thanks for listening!
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk