Commit 9d06125
committed
backport c++23 std::expected
After studied [0], [1] and [2], I'm inclined to backport [0] to
iceberg-cpp, the main reason is that [0] has exactly the same
APIs as std::expected, [1] provide some extra member functions
like `map` and `map_error`, [2] has different API names like
`then` and `thenOrThrow`.
We want users to use iceberg::expected the same way as std::expected,
and we will replace iceberg::expected with std::expected when
we decide to move to c++23 some day, by backporting [0], we can
facilitate a smoother transition process.
We discussed about `Exceptions vs Expected` in #14, while
backporting [0], I had the feeling we shouldn't choose one over
the other, we can use both approaches effectively.
expected provide monadic operations like `and_then`, `transform`,
`or_else`, `transform_error`, let us do method chaining, which
is a good sign.
[0] https://github.com/zeus-cpp/expected
[1] https://github.com/TartanLlama/expected
[2] https://github.com/facebook/folly/blob/main/folly/Expected.h
[3] https://en.cppreference.com/w/cpp/utility/expected
Signed-off-by: Junwang Zhao <[email protected]>1 parent 47f636a commit 9d06125
File tree
4 files changed
+2966
-0
lines changed- .github/workflows
- src/iceberg
- test/core
4 files changed
+2966
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
0 commit comments