3 ms·
I think Zig does a very good illustration of this distinction. They separate: - enum: essentially just a typed uint tag collection - union: the plain data str
by dgb23 6mo ago
I think Zig does a very good illustration of this distinction. They separate:
- enum: essentially just a typed uint tag collection
- union: the plain data structure that can contain any of several types
- tagged union: combines enums and unions, so you can dispatch on its tag to get one of the union types
Read from this section and they appear in order:
https://ziglang.org/documentation/master/#enum https://ziglang.org/documentation/master/#enum