4 ms·
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 th
by patates 4y 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.
- comex 4y agoC++ has std::variant these days, no need for Boost… however, neither version has particularly good ergonomics.
- wiseowise 4y ago> boost No, thanks.
- xsmasher 4y agoIf 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.