by vacuity · 3y ago · 0 comments
Assuming you share in that definition, while Go might benefit from tagged unions in general, I'm not sure they actually help in any way with remember to handle errors. A union is just as easy to forget to handle as a single discriminate type.
But perhaps you are of another sum type school? Perhaps one of the other sum type definitions are useful here?
It doesn't matter how many type layers you add. The problem is that there is nothing in the language that enforces handling of values, no matter what type that value might be.