|
Boost : |
Subject: Re: [boost] [next gen futures] Lightweight monad ready for inspection
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-06-21 20:43:17
On 21 Jun 2015 at 9:07, Vicente J. Botet Escriba wrote:
> Le 19/06/15 19:03, Niall Douglas a écrit :
> > Some may remember the thread starting from
> > http://boost.2283326.n4.nabble.com/next-gen-future-promise-What-to-cal
> > l-the-monadic-return-type-td4676039.html and that I would firstly
> > prepare an optimally lightweight monad<T> for review here before
> > going on to base a next-gen lightweight future-promise on that
> > monad<T>.
Firstly Vicente your three emails contained a ton of gold quality
observations. From those I have generated this task list:
Boost review feedback work items:
- [x] Documentation incorrectly says exceptions thrown are
future_error when they are in fact monad_error.
- [ ] Add template aliases for different configurations of monad<T>
(one of maybe, result, holder, value, retval, potential, likely). Add
two additional aliases, one for a monad without exception_ptr, and
another for a monad with neither error_code nor exception_ptr
(option<T>?).
- [ ] Make how error_type is converted into exception_type
configurable.
- [ ] Make the tribool nature of monad<T> much more formally
obvious.
- [ ] In addition to value_or(), error_or() etc add value_and(),
error_and() etc.
- [ ] As .then() is defined in a future as executing the callable
when the value is set, and monad<T>.then() executes immediately and
does not execute when the value is next changed, does this make
monad<T>.then() deceptively named? (I think yes). Perhaps and() is a
better name for then()? What about simply operator() i.e. make the
monad callable? What about operator[]?
- [ ] Add match() function which visits a callable on the contents.
- [ ] Look into member operator overloads for bind() and map() e.g.
monad<int> &m; auto r = m >> [](int a){return a;}; Can't use operator
>>=() from Haskell as has same precedence to operator=().
Thank you *hugely* for your feedback Vicente. It was extremely
valuable to me.
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