|
|
|
|
|
by flohofwoe
293 days ago
|
|
> a lack of proper sum types Do you consider Rust enums 'proper sum types'? If yes what are Zig's tagged unions missing? E.g.: const Variant = union(enum) {
int: i32,
boolean: bool,
none,
fn truthy(self: Variant) bool {
return switch (self) {
Variant.int => |x_int| x_int != 0,
Variant.boolean => |x_bool| x_bool,
Variant.none => false,
};
}
};
|
|