Using interface as it was designed to be used offers first-class sum types. Although not all interface use equates to sum types.
But they're not tagged unions. I expect that is still where your confusion lies. Tagged unions and sum types are not equivalent. Tagged unions are a subset of sum types.
Using interface as it was designed to be used offers first-class sum types. Although not all interface use equates to sum types.
But they're not tagged unions. I expect that is still where your confusion lies. Tagged unions and sum types are not equivalent. Tagged unions are a subset of sum types.