Boost logo

Boost :

Subject: Re: [boost] [review] **NEXT WEEK** Review of Outcome (starts Fri-19-May)
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-14 20:27:03


>> > Why does the library make the types possibly-empty? I couldn't find
>> the > answer in the documentation.
>
> No, I mean that the types have an empty state. variant<T...> and
> expected<T, E> don't have one.

C++ 17's variant<...> does actually. It's called valueless by exception.
It is hoped the valueless state may be removed from a future C++
standard, but for now it is present.

outcome<T>, result<T> and option<T> all have formal empty states as part
of their programming model. They are quite useful for a multitude of
uses, I mainly have used them to early out from a sequence of monadic
operations or to signal an abort from a noexcept function.

expected<T, E> does not have an empty state, and as
https://ned14.github.io/boost.outcome/md_doc_md_08-expectedsynopsis.html
explains, that will be fixed soon (end of this week on develop branch I
currently expect). For those interested in tracking the fix, you can
watch https://github.com/ned14/boost.outcome/issues/11.

(In case you are wondering why I submitted Outcome with a "defective"
expected<T, E>, it was because I was not aware of many of the deviations
from LEWG Expected that Outcome's Expected had until after my ACCU talk.
My thanks to Anthony Williams and Vicente for informing me. Realising I
could not fix all the deviations in time for code freeze for this
review, I prioritised and fixed the worst problems first. The never
empty state didn't make it in time, but as I say, it should be fixed on
develop branch within the week and it is not a state which will ever
arise unless you like throwing exceptions from your move and copy
constructors).

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