Boost logo

Boost :

Subject: Re: [boost] Outcome/expected/etc/etc/etc
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2017-06-05 21:16:31


On Mon, Jun 5, 2017 at 2:19 PM, Niall Douglas via Boost
<boost_at_[hidden]> wrote:
>>> I always wished that ASIO made the const error_code& passed in
>>> non-const, and you could set it on return from the handler. You can
>>> still throw an exception of course to abort everything, but sometimes
>>> you don't want to abort everything. Sometimes you just want to fail.
>>
>> What kind of errors do you want to return to Asio, and how do you
>> want it to respond to them?
>
> Right now if you throw an exception from within a handler the default
> action is to throw out the thread calling ioservice.run() which ran the
> handler.
>
> This isn't ideal - usually one would prefer failure to pop out of the
> initiating function instead. You can implement this manually using a
> custom async_result or easier, using future-promise, but I've always
> wished there was a lightweight non-allocating default propagation of
> handler failure => error_code => initiating function. So a super
> lightweight, non-allocating future-promise like object which can solely
> transport an error_code would be the default, that way end users can do
> .get() on the initiating function's return if they care, if not throw it
> away.
>
> Anyway, I figure that ship has sailed unfortunately.
>

It hasn't quite sailed into the standard yet.

Tony

> Niall
>
> --
> ned Productions Limited Consulting
> http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
>
>
> _______________________________________________
> 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