logoalt Hacker News

Jtsummers • yesterday at 11:44 PM • 0 replies • view on HN

To use the discriminant type on its own without carrying the baggage of the entire record and all its data, or to use the discriminant type across multiple records rather than creating some mega-record or manually synchronizing them. In Ada (again, don't know Zig but from the docs it's similar to what Ada is doing), adding a new value to the discriminant enum would cause a compile time error in all the variant records using it and all the case statements (match, but Ada's version), as long as they didn't have a catchall branch.