This isn’t the blog post I wanted to publish today, this is the blog post I had to publish.
Simon blogged about using ADTs for error handling, leading to an interesting reddit discussion. Then Vittorio wanted to share his thoughts on the matter, leading to an even bigger reddit discussion. Now I’d like to chime in and offer a reasonable solution.
It is the age-old question: return codes vs exceptions.
But this time, return codes have gotten an upgrade:
std::expected and similar types.