Partially Matching Zig Enums
35 points by runxiyu
35 points by runxiyu
I do enjoy comptime unreachable
In principle in the first case the type system could prove that wildcard _
case is actually unreachable, with flow typing/type narrowing (ala Kotlin, TypeScript). There is some complication with this in general though. In a sense this is what the Zig version is doing!
Yes, the big difference here seems to be nominal typing vs structural typing. That it works in Zig is neat though.