3 ms·
Zig has tagged unions. Functions can return things other than integers. I don’t see what’s so hidden about allowing unions to be returned as errors. It is all i
by ratorx 4y ago
Zig has tagged unions. Functions can return things other than integers. I don’t see what’s so hidden about allowing unions to be returned as errors. It is all in the functions return type.
An error is an abstraction Zig has chosen to provide over an integer. Without discarding any part of their philosophy, they can make this custom abstraction a bit more useful by allowing tagged unions to be errors.
Not allocating has nothing to do with not having errors. You can have tagged union errors without any allocation. Rust has them.