Hacker News new | ask | show | jobs
by dthul 1041 days ago
Ever since I learned of sum types, they have ruined my enjoyment of programming languages which don't have them. I sorely miss them in C++ for example (and std::variant is not a worthy alternative). I don't understand why any new language wouldn't have them.
3 comments

Pedantic typechecking is like learning to spot improper kerning, you think it’s a good thing but you spend your entire life cringing at the world around you.
std::variant is a good example of many things bad with c++ improvement process, as a language.

If you want to just pattern match on type of visitor there is “another convenience helper” that you need to bring, and result still looks not pleasant.

Introduced in like c++17, even in c++23 you still need to write a std::visit to process it. Committee members waste time on yak shaving that std::print

Just wait until you learn union types, type classes, type providers, and so on. It's even worse afterwards. :-)