On 5.2.2016. 10:25, Niall Douglas wrote:
On 4 Feb 2016 at 23:02, Domagoj Saric wrote:
You could theoretically pass exceptions function-to-function by exception_ptr but that seems backwards, no pun intended. :)
And we could theoretically and practically ;) return actual error objects (even those considered 'exceptions', e.g. std::runtime_error) w/o necessarily stuffing them into some type erasing mechanism like exception_ptr (i.e. you pass the ball as a ball until you need to interact with someone who only understands abstract UFOs;)
exception_ptr is like shared_ptr - the potential use of atomics forces the compiler to emit code just in case. Any potential use of atomics is like calling fsync() on the compiler's AST.
That's (in line with/part of) my point?
Firstly I just found and read your RFC on this potential Boost.Err at http://lists.boost.org/Archives/boost/2015/11/226558.php. You posted this during my vacation away from Boost, so I didn't see it till now. I'd like to thank you for this contribution to the debate, it certainly is original.
There are some very interesting - perhaps even debatable - feature choices in this object. I'll skip commenting on most of those, but I will say one thing - I've found in AFIO v2 the ability to use outcome::result<T> as a receiving container surprisingly useful. The pattern looks like this: <snip> In other words, I found my result<T> very useful as a state accumulator which can "go errored" in a natural way.
Can you elaborate more on what you mean by "state accumulator" and
"going errored in a natural way" in this context? + you seem to be using
'container' and 'accumulator' interchangeably while AFAIK those are not
eqivalent concepts...
If by 'state accumulation' you imply the requirement that the result
Your Err object can't do value semantics - it cannot be a container in its own right. I personally think that is unfortunate for the reasons above. I think there is much more usefulness in these objects having full value semantics BUT with a restricted variant content,
I don't know what you mean here: * there is no 'Err object', there are two types - fallible_result and result_or_error[1] * both of those carry Ts and Es by value
so basically either it's the value you want OR it's why there isn't a value you expect there.
AFAICT that's exactly how the two Err objects work..? [1] it 'dawned' on me a few days ago that the langauge change/addition I already 'requested'/wished for (rvalue destructor 'overloads') would also enable that the two types (fallible_result and result_or_error), could be merged (as esentially their only major difference is on-destruction behaviour)... -- "What Huxley teaches is that in the age of advanced technology, spiritual devastation is more likely to come from an enemy with a smiling face than from one whose countenance exudes suspicion and hate." Neil Postman