Subject: Re: [boost] [outcome] To variant, or not to variant?
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-06-02 21:51:55
On 02/06/2017 15:57, Peter Dimov via Boost wrote:
> Niall Douglas wrote:
>> 3. User wants to write functional programming logic using the basic
>> vocabulary of Maybe, Either and i/o monads and basic operators of
>> bind, fmap, do etc and probably some subset or refinement of Hana for
>> the collections monads, though my GSoC student may be making the
>> Ranges TS a choice here as well later this summer.
>> All-narrow observers make sense for this use case as the monadic
>> operators ensure your function will never be called with the wrong state.
> There's no need for narrow (value) observers when using the monadic
> interface; it's all wide and since you get the value directly, you don't
> need to observe it.
Not always. Sometimes your function will be fed a wrapped value and
you'll need to observe it. I still think narrow makes more sense here.
I also forget another thing which use case 3 needs, and that is
immutability, which in turn probably in C++ implies that the types used
must be trivially destructible, else it would be unusable. In other
words, the code must be written as if able to run constexpr, probably.
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/