2 ms·
You make a good point that the standard library could make better use of this pattern to show it off, but the language was designed with this sort of thing as a
by dnautics 6y ago
You make a good point that the standard library could make better use of this pattern to show it off, but the language was designed with this sort of thing as an affordance and there even is a (rough) example in the docs: https://ziglang.org/documentation/master/#Tagged-union https://ziglang.org/documentation/master/#Tagged-union
You wouldn't have to rewrite the world, but the language is young and maybe more effort could go into making using this pattern more idiomatic and encourage library writers to do it more often.