Boost logo

Boost :

Subject: Re: [boost] [gsoc-2013] Boost.Expected
From: Pierre T. (ptalbot_at_[hidden])
Date: 2013-04-29 02:29:19


On 04/29/2013 08:11 AM, Vicente J. Botet Escriba wrote:
> Le 28/04/13 23:28, Rob Stewart a écrit :
>> On Apr 28, 2013, at 2:17 PM, "Pierre T." <ptalbot_at_[hidden]> wrote:
>>
>>> On 04/28/2013 07:30 PM, Vicente J. Botet Escriba wrote:
>>>>>> Yes this is quite similar if we had exceptions and we had a
>>>>>> try/catch block
>>>>>>
>>>>>> f0().then(f1).then(f2).then(f3).visit_error(error_visitor);
>>>>>>
>>>>>> try {
>>>>>> f3(f2(f1(f0())));
>>>>>> } catch(...) {
>>>>>> error_visitor();
>>>>>> }
>> When the chain gets long, try blocks make increasing sense.
> Agreed.
Right, but we can work with non-exception based error.
>>
>>>>>> It would be great if we could have the equivalent for
>>>>>> try {
>>>>>> h(f(), g());
>>>>>> } catch(...) {
>>>>>> error_visitor();
>>>>>> }
>>>>>>
>>>>>> when_all(f(), g()).then(h).visit_error(error_visitor);
>> "if_all" seems better than "when_all".
>>
> +1.
+1 too. But I'd like to keep the "then" taking more than one function.

e.then(h).then(f, g).then(h2).on_error(error_resolver);

try{
   h2(f(h()), g(h()));
} catch(…) {
   error_resolver();
}

The goal would be to enable any function composition.

>
> Vicente
>

Best regards,
Pierre T.


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