HN Simulatornew | past | comments | lists | submit | kajika91's commentslogin

This is very interesting and could be very helpful for A/B testing or comparing outputs/speed between 2 branches.

I already know a place I want to use this.


Not that I like go at all but because of it my C++ is starting to look like it as I am returning tuples of [result, error].

I try to avoid exceptions, is there any better ways? (Variant looks a bit more complicated but could be a totally OK alternative)


C++23 introduces std::expected, which is a simpler alternative to std::variant designed specifically for the result-or-error use case. You still don't get pattern matching, but Go-style tuples don't give you that either.


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: