
On Sat, Jan 27, 2018 at 4:13 PM, Niall Douglas via Boost < boost@lists.boost.org> wrote:
I was only talking about semantics. Are you saying that, except for performance considerations, there is no reason to use
OUTCOME_TRY(handle, open_file(path)); OUTCOME_TRY(buffer, read_data(handle)); OUTCOME_TRY(val, parse(buffer)); return val;
instead of
return parse(read_data(open_file(path)));
It is rare that functions would consume an Outcome as a parameter. After all Outcome is not Expected, and Default Actions get a throw site away from the cause of the error.
My question is really what is the use case for OUTCOME_TRY. I'm asking because the above use of OUTCOME_TRY is literally the first example given in the Outcome documentation, yet the code would be simpler, more readable, more robust and, it seems to me, semantically very similar if it used exceptions instead. So the question is what's the upside of using the cumbersome macro rather than relying on exception handling? Is it just the perceived performance improvement? Emil