Subject: Re: [boost] [next gen future-promise] What to call the monadic return type?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2015-05-28 13:56:04


Le 28/05/15 13:38, Peter Dimov a écrit :
> Vicente J. Botet Escriba wrote:
>
>> I see that you want to be able to store error_code or exception_ptr.
>> Wouldn't the interface of expected<T, variant<error_code,
>> exception_ptr>> be enough?
>
> future<T> already adds the ability to store exception_ptr. There is no
> need to store another exception_ptr in the value. Niall's type is
> exactly equivalent to future<expected<T, error_code>>, as I already
> said (twice).
I was talking of the to be named type, from which Nial want to derive
its future ;-)
>
>> I proposed to the C++ standard a function future<T>::next (bind) that
>> takes a continuation having T as parameter (future<R>(T)), and and
>> future<T>::catch_error that takes a as parameter a continuation that
>> takes an errror as parameter. The proposal was not accepted.
>
> future<T>::next( [](T){...} ) is actually pretty useful, catch_error()
> much less so. You should have proposed just the former. (Sean Parent's
> future implementation's ::then has ::next's semantics IIRC.)
We never know what we should do. Without catch_error(), you need yet
.then() as you want to be able to recover from errors in the same way.

Vicente