Hacker News new | ask | show | jobs
by patates 1200 days ago
I'm a big fan of TS, but discriminated unions are available in a lot of languages and when not, there's usually some library adding it like boost::variant if the language has runtime types or templating/macros.
3 comments

C++ has std::variant these days, no need for Boost… however, neither version has particularly good ergonomics.
If I understand std::variant, it THROWS if you try to access the wrong type?

I should have been specific, but all of the errors I mention above are compile-time errors, not run-time.

> boost

No, thanks.