[outcome] Major changes for Boost 1.72 release
Just as a heads up to those who care, and any pretesting of these changes in advance of the Boost release is welcome. There are two breaking changes: 1. The git submodule mechanism used by standalone Outcome of specifying dependent libraries has been replaced with a cmake superbuild of dependencies mechanism instead. Upon cmake configure, an internal copy of quickcpplib will be git cloned, built and installed into the build directory from where an internal `find_package()` uses it. This breaks the use of the unconfigured Outcome repo as an implementation of Outcome, one must now do one of: 1. Add Outcome as subdirectory to cmake build 2. Use cmake superbuild (i.e. `ExternalProject_Add()`) to build and install Outcome into a local installation. 3. Use one of the single header editions. 2. For standalone Outcome, the current compiler is now checked for whether it will compile code containing C++ Concepts, and if it does, all cmake consumers of Outcome will enable C++ Concepts. Set the cmake variable `CXX_CONCEPTS_FLAGS` to an empty string to prevent auto detection and enabling of C++ Concepts support occurring. There are two new features: - Standalone outcome is now `make install`-able, and cmake `find_package()` can find it. Note that you must separately install and `find_package()` Outcome's dependency, quickcpplib, else `find_package()` of Outcome will fail. - Support for C++ Coroutines has been added. This comes in two parts, firstly there is now an `OUTCOME_CO_TRY()` operation suitable for performing the `TRY` operation from within a C++ Coroutine. Secondly, in the header `outcome/coroutine_support.hpp` there are implementations of `eager<OutcomeType>` and `lazy<OutcomeType>` which let you more naturally and efficiently use `basic_result` or `basic_outcome` from within C++ Coroutines -- specifically, if the result or outcome will construct from an exception pointer, exceptions thrown in the coroutine return an errored or excepted result with the thrown exception instead of throwing the exception through the coroutine machinery (which in current compilers, has a high likelihood of blowing up the program). Both `eager<T>` and `lazy<T>` can accept any `T` as well. Both have been tested and found working on VS2019 and clang 9. More detail can be found at: https://boostorg.github.io/outcome/changelog.html Niall
On Thu, 10 Oct 2019 at 16:25, Niall Douglas via Boost
Just as a heads up to those who care, and any pretesting of these changes in advance of the Boost release is welcome.
There are two breaking changes:
1. The git submodule mechanism used by standalone Outcome ... 2. For standalone Outcome ... - Standalone outcome ...
Any changes for the Boost-version? - Support for C++ Coroutines has been added. This comes in two parts,
firstly there is now an `OUTCOME_CO_TRY()` operation suitable for performing the `TRY` operation from within a C++ Coroutine. Secondly, in the header `outcome/coroutine_support.hpp` there are implementations of `eager<OutcomeType>` and `lazy<OutcomeType>` which let you more naturally and efficiently use `basic_result` or `basic_outcome` from within C++ Coroutines -- specifically, if the result or outcome will construct from an exception pointer, exceptions thrown in the coroutine return an errored or excepted result with the thrown exception instead of throwing the exception through the coroutine machinery (which in current compilers, has a high likelihood of blowing up the program). Both `eager<T>` and `lazy<T>` can accept any `T` as well. Both have been tested and found working on VS2019 and clang 9.
I'll use exceptions instead, I think. degski -- @realdegski https://brave.com/google-gdpr-workaround/ "We value your privacy, click here!" Sod off! - degski "Anyone who believes that exponential growth can go on forever in a finite world is either a madman or an economist" - Kenneth E. Boulding "Growth for the sake of growth is the ideology of the cancer cell" - Edward P. Abbey
Any changes for the Boost-version?
If the changelog says Boost Outcome, it's Boost Outcome only. If it says Standalone Outcome, it's Standalone Outcome only. If it says Outcome, it's both.
- Support for C++ Coroutines has been added. This comes in two parts,
firstly there is now an `OUTCOME_CO_TRY()` operation suitable for performing the `TRY` operation from within a C++ Coroutine. Secondly, in the header `outcome/coroutine_support.hpp` there are implementations of `eager<OutcomeType>` and `lazy<OutcomeType>` which let you more naturally and efficiently use `basic_result` or `basic_outcome` from within C++ Coroutines -- specifically, if the result or outcome will construct from an exception pointer, exceptions thrown in the coroutine return an errored or excepted result with the thrown exception instead of throwing the exception through the coroutine machinery (which in current compilers, has a high likelihood of blowing up the program). Both `eager<T>` and `lazy<T>` can accept any `T` as well. Both have been tested and found working on VS2019 and clang 9.
I'll use exceptions instead, I think.
I can see no gain to using anything except Outcome's awaitables if you're already using Outcome in Coroutines (which quite a few people are, it was a requested feature add). They're more efficient, and make your coroutines effectively 100% noexcept apart from the frame allocation without you having to do anything else. As it happens, at work I needed Outcome working well with Coroutines, hence the sudden prioritisation of the implementation, as I was able to use work time to do it rather than personal time. eager<T> and lazy<T> also have atomic editions, called atomic_eager<T> and atomic_lazy<T>. These use an atomic for coroutine completion, and thus synchronise the coroutine result between threads. Niall
On 11/10/2019 02:25, Niall Douglas wrote:
- Support for C++ Coroutines has been added. This comes in two parts, firstly there is now an `OUTCOME_CO_TRY()` operation suitable for performing the `TRY` operation from within a C++ Coroutine. Secondly, in the header `outcome/coroutine_support.hpp` there are implementations of `eager<OutcomeType>` and `lazy<OutcomeType>` which let you more naturally and efficiently use `basic_result` or `basic_outcome` from within C++ Coroutines -- specifically, if the result or outcome will construct from an exception pointer, exceptions thrown in the coroutine return an errored or excepted result with the thrown exception instead of throwing the exception through the coroutine machinery (which in current compilers, has a high likelihood of blowing up the program). Both `eager<T>` and `lazy<T>` can accept any `T` as well. Both have been tested and found working on VS2019 and clang 9.
How hard would it be to also support Boost.Coroutine2?
On 10/10/2019 23:51, Gavin Lambert via Boost wrote:
On 11/10/2019 02:25, Niall Douglas wrote:
- Support for C++ Coroutines has been added. This comes in two parts, firstly there is now an `OUTCOME_CO_TRY()` operation suitable for performing the `TRY` operation from within a C++ Coroutine. Secondly, in the header `outcome/coroutine_support.hpp` there are implementations of `eager<OutcomeType>` and `lazy<OutcomeType>` which let you more naturally and efficiently use `basic_result` or `basic_outcome` from within C++ Coroutines -- specifically, if the result or outcome will construct from an exception pointer, exceptions thrown in the coroutine return an errored or excepted result with the thrown exception instead of throwing the exception through the coroutine machinery (which in current compilers, has a high likelihood of blowing up the program). Both `eager<T>` and `lazy<T>` can accept any `T` as well. Both have been tested and found working on VS2019 and clang 9.
How hard would it be to also support Boost.Coroutine2?
Probably not particularly hard, though you'd need something like BOOST_OUTCOME_COROUTINE2_TRY(), which is rather a mouthful to constantly have to type. Niall
participants (3)
-
degski
-
Gavin Lambert
-
Niall Douglas