4 ms·
That's just std::optional<> vs std::string, isn't it?
by TillE 3y ago
That's just std::optional<> vs std::string, isn't it?
- fnfjfk 3y agoYes, and std::optional is a janky implementation of a sum type in a language that doesn’t have them. The ergonomics are bad, and it is easy to make your program blow up if you forget a check. In a language with sum types like Rust, Kotlin, and Swift, if you’re following the default “happy path” of coding, you are not allowed to forget a check. The compiler will not let you.