10 ms·
Rust's Union is for C FFI, right? Why not call Enum Union, and the FFI one CUnion or something? Like, is there something meaningful that Union is for other th
by binary132 3y ago
Rust's Union is for C FFI, right?
Why not call Enum Union, and the FFI one CUnion or something? Like, is there something meaningful that Union is for other than C interop? Isn't it functionally identical to a tagged union in every other respect?
- steveklabnik 3y agoC FFI is a very useful thing, sure, but I don’t think it’s exclusive to that. It’s a nice primitive to have access to. I think Rust would feel weird with tagged unions and not untagged ones, just like having both sum and product types are good.
- tialaramex 3y ago> Rust's Union is for C FFI, right? No :) > is there something meaningful that Union is for other than C interop? Look more closely at the Rust standard library, MaybeUninit<T> is a union.