result
result
result | result | |
---|---|---|
5 | 2 | |
265 | 314 | |
- | - | |
0.0 | 0.0 | |
over 1 year ago | 5 months ago | |
C++ | C++ | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
result
-
Real-world examples of std::expected in codebases?
Example of other people trying to do it in a generic way, as a separate library (instead of in the utility part of some bigger codebase): - https://github.com/bitwizeshift/result - https://github.com/oktal/result - https://github.com/basicpp17/result17 - https://github.com/p-ranav/result
-
std::expected (with monadic interface) implementation in C++20 (P0323, P2505)
As someone who is new to this API (so I can't discern from the list of features which might be better for my use case), I second the question, and I'd like to extend the question to how it compares to https://github.com/martinmoene/expected-lite and https://github.com/bitwizeshift/result as well.
- A modern Result type in C++
- C++ “result” type based on modern languages like Swift and Rust
- Modern C++ "result" type based on Swift / Rust
result
-
Real-world examples of std::expected in codebases?
Example of other people trying to do it in a generic way, as a separate library (instead of in the utility part of some bigger codebase): - https://github.com/bitwizeshift/result - https://github.com/oktal/result - https://github.com/basicpp17/result17 - https://github.com/p-ranav/result
-
Is Haskell a Good Choice for Software Security?
I'd say, take a look at error handling. In Haskell you can accomplish a lot by just using `Maybe` and `Either` along with the functions related to them, provided by the standard library. Haskell's pattern matching feature makes it even more straight forward to handle these types.
A lot of this translates to Rust, as Haskell influenced the language design of Rust. In Rust you have `std::option::Option` and `std::result::Result` which relate closely to `Maybe` and `Either`, respectively. Also pattern matching is available in Rust.
When you then look at other (imperative) languages like Go, C, and C++, error handling becomes a bit more cumbersome IMHO. I am not talking about explicit or implicit error handling. It's more about urging the programming to check for and handle errors, and also giving them the necessary tools to do that efficiently.
In Go, you have lots of `if err != nil { return err }`, which is cumbersome to write (luckily we have snippets) and _clutters_ the code. Yes, it is explicit and easy to read, but I don't think error handling should make up 4/5 of the lines of your algorithm.
The same applies to C, more or less, as functions typically tell you about success or failure via their return value. Like `err` in Go.
In C++ we have `std::optional` which is handy, but C++ lacks a lot of functional features and convenient syntax to take full advantage of it. No straight forward pattern matching here. There is `std::variant` to create sum types, but I've only seen that in use occasionally. There is also `std::expected` on the horizon, which is similar to `Either` / `std::result::Result`, but adoption will take ages.
C++, being a complicated language, makes it very difficult to just come up with your own wrapper classes that _just work_. See https://github.com/oktal/result/blob/master/result.h for example.
What are some alternatives?
exceptxx - C++ exception handling library
powerloader
robin-hood-hashing - Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
BackportCpp - Library of backported modern C++ types to work with C++11
entt - Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more
expected - P0323 & P2505 std::expected simple implementation
RSL - ROS Support Library
result17 - A rust like Result type for modern C++