Hacker News new | ask | show | jobs
by fallingsquirrel 583 days ago
It's an interesting pattern, but it's a shame there's no way to efficiently use one of those OptionalXIndex with zig's actual null syntax, `?` and `orelse` and etc. It would be smoother if you could constraint the nonexhaustive range, and let the compiler use an unused value as the niche for null. Maybe something like `enum(u32) { _ = 1...std.math.maxInt(u32) }`
1 comments

There's an issue tracking that: https://github.com/ziglang/zig/issues/3806