|
Boost : |
Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-14 13:47:55
Christopher Kohlhoff wrote:
> > There must exist a generic way to test for failure.
>
> Why must this exist? (With the emphasis placed on "generic".)
For the reason I stated; so that one can write a function whose logic is not
broken when a callee switches (or is switched, or is ported) to another
implementation and starts returning error codes from a different domain. And
similarly, so that one can use several helper functions in one's
implementation, each returning codes from a different domain, without the
caller being hopelessly confused by it. That's what "encapsulate" means - to
achieve a degree of independence.
Having a generic way does not in any way preclude one to be able to
(re)interpret success/failure in the concrete case, when the errors returned
are of a specific fixed domain. That's a separate use case and it won't go
away.
A generic success condition is conceptually not any different from a generic
"not found" condition. If you have domain-specific knowledge about what is a
success, you won't compare to generic success, and if you have
domain-specific knowledge about what wasn't found, you won't compare to
generic not found. And consequently, an argument against the former is also
an argument against the latter.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk