
On Thu, Jan 18, 2018 at 2:07 PM, charleyb123 . via Boost < boost@lists.boost.org> wrote:
Hi, Everyone,
The formal review of Niall Douglas' Outcome (v2) library begins Fri-19-Jan and continues until Sun-28-Jan, 2018.
From the Outcome documentation:
auto read_int_from_file(string_view path) noexcept -> outcome::result<int> { OUTCOME_TRY(handle, open_file(path)); // decltype(handle) == Handle OUTCOME_TRY(buffer, read_data(handle)); // decltype(buffer) == Buffer OUTCOME_TRY(val, parse(buffer)); // decltype(val) == int return val; } Question: if using the OUTCOME_TRY macro is equivalent to calling the function, checking for error and then returning an error if there is an error, how is this different from using exceptions? Semantically, exception handling does nothing more than check for errors and returning errors if there were errors, with much more readable syntax: return parse(read_data(open_file(path))); This kind of macro use seems rather inelegant and more appropriate for C programs, though it may be justified in C since it lacks exception handling. Emil