Comment

Comment by loeg

Yeah. In the C++ codebase I work on, we use folly::Expected<T, E> (essentially similar to Rust's Result<T, E>) heavily. Is it as ergonomic as Result is in Rust? Absolutely not. But it's still a nice design pattern for some of the same reasons people use Result in Rust.

(And C++ std::optional<T> is somewhat similar to Rust's Option<T> type.)

https://github.com/facebook/folly/blob/main/folly/Expected.h...

parent loeg 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton