|
|
|
|
|
by rastrian
171 days ago
|
|
I think you’re both pointing at the same tradeoff: “untagged” unions feel lighter, but you often pay it back in ad-hoc narrowing (shape checks/heuristics) and ambiguity once variants overlap. Tagged unions/ADTs make the discriminant explicit, which is exactly why they tend to be reliability-friendly: exhaustive matches + explicit constructors reduce “guessing” and refactor breakage. That said, I agree the ergonomics matter, TS-style discriminated unions are basically “tagged” too once you add a kind field, for example. |
|