Skip to content

Comment on A Gopher Meets a Crabparent

Comments

It's true that `std::expected` is like if a C++ programmer saw a type like Result in a shop window and copied the parts they understood from that and so certainly if you're a C++ programmer this is superficially satisfying.

The blog post uses, among other things, the Try operator ? and pattern matching, neither of which are available in C++ and both of which make the Result type much nicer to use than std::expected. There have been similar "I saw it in a shop window" proposals for both these in C++, and I expect that pattern matching in particular will be attempted again targeting C++ 29.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.