Boost logo

Boost :

Subject: Re: [boost] Final lightweight monad, next gen futures and upcoming AFIO review
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-06-29 06:07:23


On 28 Jun 2015 at 21:05, Michael Marcin wrote:

> > I mean: result<T, E> is like "give me T or it's an error". There is no
> > empty state. Empty would already be an error state. I'd only understand
> > empty if it's an async operation that didn't finish already.
>
> What's the state of a default constructed result<T, E>?
>
> Is it an error state?
> Is it empty?
> Or is it not default constructible?

In my dirty monad, result<T> (there is no result<T, E>) is always
default constructed to empty. If you want it constructed to something
else, simply pass that into its constructor. There is also a
make_monad(T/error_code/exception_ptr).

In Rust's Result<T, E>, there is no default construction. You must
choose either a T or a E at the point of construction, failure to do
so is a compile time error.

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