4 ms·
> I use unexpressive languages like Go or Zig See, I would not call Zig unexpressive. I've written a number of iteration structs in Zig, because it has true op
by samatman 2y ago
> I use unexpressive languages like Go or Zig
See, I would not call Zig unexpressive. I've written a number of iteration structs in Zig, because it has true optionals this is easy, using them is just:
var iter = thing.iterateSomeWay();
while (iter.next()) |item| {
// do stuff
}
It's a low level language, yes, but an expressive one given that design constraint. Go just makes this stuff harder, because nil is just zero wearing a costume, an antipattern it inherited from C. In Zig every type can be nullable, and the compiler takes care of representing the null case distinctly from the load-bearing one.