The cool thing is that all this functionality is accessible through the match() syntax, which exhaustively checks all possible forms the Enum can take, thus making data access completely safe.
This sort of overloading of language happens all over the place in programming and it leads to endless confusion. I find it extremely frustrating but what can I do about it?
Also Enum seems a good name because they represent fixed alternatives that may be (finitely) enumerated (We're saying "Let me enumerate the alternatives that this type may hold."). Whereas "union" seems to speak to its underlying implementation (which may or may not hold) as a tagged, overlapping union. Ie. that usage of union says much less about the intended semantics and is more of a possible implementation detail. Otherwise if you look at the actual meaning of "union" it doesn't seem to fit really. Maybe "sum" might be closer but again that's leaning towards the theoretical, and in that case you'd probably then need to rename struct to become "product" for symmetry.
enum Day {
Monday, Tuesday, Wednesday, ...
}
You can assign values too: enum Color {
Red = 0xff0000,
Green = 0x00ff00,
Blue = 0x0000ff
}