Boost logo

Boost :

Subject: Re: [boost] [boost.ublas] [gsoc'15]
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-03-15 20:59:34


On 15 Mar 2015 at 16:59, Mikael Persson wrote:

> > Should we use exceptions or return codes ?
>
> I agree with all that you've said on this. It's very true that one of the
> nice benefits of exceptions is that they allow you to retain the nice
> functional / expression syntax, that is, instead of having to do each
> operation on its own line, grabbing the error-code and checking it.

The lightweight non-allocating future<T, E> I proposed here many
months ago is functional, returns any unexpected type E you like, and
the compiler should completely elide the future code if it isn't
necessary. In other words, you write your code with promise-futures,
and only if they cross a thread boundary does the compiler actually
generate any code for them.

I decided against implementing those properly, but AFIO v1.4's
afio::future<T> will be non-allocating and lightweight (i.e. elidable
by the optimiser). It also will carry either a type T, an error_code
or an exception_ptr, so it's a fixed function constexpr variant
transport.

I'll be donating that afio::future<T> to Boost.Thread v5 probably as
lightweight_future<T>. Someone else may decide to turn it into a
totally generic solution suitable for replacing future/promise in C++
17. Or they may not.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



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