
2015-06-29 8:37 GMT+02:00 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr
:
Le 26/06/15 13:00, Niall Douglas a écrit :
On 26 Jun 2015 at 10:42, Andrzej Krzemienski wrote:
monad is now space optimal, consuming as little as two bytes
depending on configuration. monad<void> is now working, plus these new specialisations were added:
* result<T>: empty/T/error_code (no exception_ptr).
To what run-time condition does an empty state correspond here? I used to thing that you either have a result (T) or a reason why you do not have one (error_code), but what does it mean that you have neither?
Semantically speaking, after feedback from this list, and having attended Charley's C++ Now Presentation on ternary logic programming "Your CPU is Binary", I realised that it's worthwhile to formally specify future/monad/result as ternary logic primitives with ternary logic operators. option<T> remains boolean. This gives the following logic table:
Empty => False (future/monad/result/option) Errored/Excepted => Indeterminate (future/monad/result) Value => True (future/monad/result/option)
The meaning of empty in optional/option and future is not the same. For the fist is a valid state, for the second is an invalid state.
If "empty" means something different in the case of three-type "result", perhaps it deserves a different name?
In addition asynchronous types have an additional state not-ready, e.g. future can be invalid, not-ready, exceptional or valued.
So it looks like you have two sets of error codes: 1. The one represented by E in result<T, E> 2. A set of error conditions inherent to asynchronous state processing: "invalid", "not ready" (maybe also "already retrieved"). Regards, &rzej