[outcome] Some documentation suggestions
Maybe I could send some PRs later (I've already sent one a few moments
ago). But, for now, I'll have to postpone.
Notes:
- You put too much focus in "open (error) type hierarchies" (e.g.
`error_code`). Not a problem. Also, do not change anything just because
this comment. Really, it is not a problem.
- The beginning of the documentation gave me the impression that I could
only use EC types that were convertible to `std::error_code`[1], “it need
in fact to merely satisfy trait::has_error_code_v<EC>”. Later pages
corrected my understanding.
- “only works when the EC type is the same in the try expression as the
calling function”[2] is misleading. `OUTCOME_TRYV(outcome::result
One more thing: Documentation around policies is confusing. I don't know when my policy's function would be called. I only know which Outcome's function will call it.
From this page[1], I understand that my policy's function will do the check to see if value is valid.
But another page[2] will tell me that all_narrow's functions will call _ub() **undiscriminately**. Does it mean that the checks are performed internally by Outcome and policy's functions are only called conditionally? If that is the case, documentation for **when** these functions are called should be provided. [1] https://ned14.github.io/outcome/tutorial/policies/anatomy/ [2] https://ned14.github.io/outcome/tutorial/policies/builtin/ 2018-01-24 12:03 GMT-03:00 Vinícius dos Santos Oliveira < vini.ipsmaker@gmail.com>:
Maybe I could send some PRs later (I've already sent one a few moments ago). But, for now, I'll have to postpone.
Notes:
- You put too much focus in "open (error) type hierarchies" (e.g. `error_code`). Not a problem. Also, do not change anything just because this comment. Really, it is not a problem. - The beginning of the documentation gave me the impression that I could only use EC types that were convertible to `std::error_code`[1], “it need in fact to merely satisfy trait::has_error_code_v<EC>”. Later pages corrected my understanding. - “only works when the EC type is the same in the try expression as the calling function”[2] is misleading. `OUTCOME_TRYV(outcome::result
{err::success})` works inside a function returning `outcome::result<void>` given `err` is convertible to `std::error_code`. [1] https://ned14.github.io/outcome/tutorial/payload/ [2] https://ned14.github.io/outcome/tutorial/default-actions/error-codes/
-- Vinícius dos Santos Oliveira https://vinipsmaker.github.io/
-- Vinícius dos Santos Oliveira https://vinipsmaker.github.io/
Documentation around policies is confusing. I don't know when my policy's function would be called. I only know which Outcome's function will call it.
That's the only way your policy's function is ever called, by the Outcome function documented.
From this page[1], I understand that my policy's function will do the check to see if value is valid.
But another page[2] will tell me that all_narrow's functions will call _ub() **undiscriminately**. Does it mean that the checks are performed internally by Outcome and policy's functions are only called conditionally?
Yes, I see the problem on [2]. It doesn't say that `_ub()` is called on invalid observation only. I'll fix that now. Thanks for the feedback. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
- You put too much focus in "open (error) type hierarchies" (e.g. `error_code`). Not a problem. Also, do not change anything just because this comment. Really, it is not a problem.
This is true. It stems from an assumption that people likely to use Outcome already understand error coding enums, and need to be made more aware of how to speak `error_code` using their existing error coding enums.
- The beginning of the documentation gave me the impression that I could only use EC types that were convertible to `std::error_code`[1], “it need in fact to merely satisfy trait::has_error_code_v<EC>”. Later pages corrected my understanding.
Ok, I'll clarify that any EC type can be used on your [1].
- “only works when the EC type is the same in the try expression as the calling function”[2] is misleading. `OUTCOME_TRYV(outcome::result
{err::success})` works inside a function returning `outcome::result<void>` given `err` is convertible to `std::error_code`.
I'll clarify this as well. Thanks for the feedback. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
participants (2)
-
Niall Douglas
-
Vinícius dos Santos Oliveira