Vicente, when he reviewed Outcome's docs, was pretty appalled at how error handling focused they are. His view is that Expected is an EITHER monad where E is exactly like T, and he was not happy that Outcome presents Expected as if it is solely for use for returning stuff from functions.
And, he is right.
No, he isn't. The whole point of expected<> is that T is not like E. That's why T is _expected_, and E is _unexpected_. It's in the name.
When T is like E, you use variant
. Or variant . My own idea of expected
takes one T and an arbitrary amount of Es, and while all Es are alike, T isn't. And this aside, the general idea is to provide alternative to exceptions, which kind of implies returning stuff from functions, does it not?
As you might guess, Vicente would say that Expected *can* be used for returning stuff from functions, but also a long list of other stuff. But I won't put words in his mouth. He is subscribed here too after all, he can answer himself if he chooses to. Outcome doesn't get a ton of choice with its Expected implementation. Either it implements the Expected proposal for standardisation, or it doesn't. I don't want the Outcome refinements to veer too strongly away from LEWG Expected, they ought to be similar, except where it's necessary to be different, in order to make it cognitively easy for end users. Even where I personally think Expected is making a mistake. As much as I've kicked up a fuss in some places by intentionally deviating from LEWG Expected to force some attention at where I think there are problems, after this review I'll go ahead and conform as tightly as I reasonably can and I'll track the LEWG proposal over time. A deviating implementation muddies the waters, is confusing for end users, and helps no one. BTW Outcome's Expected now lives in an experimental namespace on develop branch. I'll post a full set of changes already logged in this pre-review when the review officially starts on Friday so people don't waste time repeating things already logged by others. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/