Subject: Re: [boost] [outcome] success-or-failure objects
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-01-23 22:40:13
On 24/01/2018 11:13, Emil Dotchevski wrote:
>> There's a sizeable number of people who are very keen on doing so. Hence
>> std::logic_error and family i.e. WG21 historically has agreed.
> It is unreasonable to think that a program that has just encountered a
> logic error can recover gracefully from it any more it can do so from a
> crash. Try to recover, and you might make things worse, possibly much worse.
Not necessarily. It depends on how well-partitioned things are and how
far-reaching the side effects executed thus far affect other things.
For an example, think of a web browser. At some point it parses some
malformed HTML and sets a property local to the page to null. At some
later point something accesses that property without checking for null
first. This is a logic error, but it's a completely benign and
recoverable one (at least on platforms where memory around null is
guaranteed to be invalid). The browser can recover simply by aborting
the load/render of that page and showing an error, without affecting any
other pages or crashing the browser itself.
Other similar cases exist, where a data structure might be left in an
undefined but still destructible state, but it doesn't matter because
the error recovery process will just destroy that structure anyway.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk