> Variant types where one has to use objects as types don’t come up that often in API design or …
> Variant types where one has to use objects as types don’t come up that often in API design or data structures in my experience with mobile and system programming on e.g. Linux You can't use what you don't have, so you adapt to the tools you do have. In my C++ time, the team would often write types that logically held several variants. However they were expressed as product types, so with space overhead and error-prone, unergonomic use. Sum types are game-changing. Look at any Rust project you'll find enums with data everywhere. They're just a building block to model problems, like product types are. A language that miss them is as strange too me as a language without product types. After 10 years of mostly C++11 and C++14 I would never go back to it for this reason alone (although as outlined in the article there are other reasons too). > Error types are probably the most popular incarnation of that. There’s several libraries available and they will be part of the C++ standard. Again, with what performance and ergonomics?
Original discussionSwitching from C++ to Rust275 source comments · at import