News for hackers. Stuff that matters.
Re:Why people are angry over Go 1.23 Iterators by samatman on Tuesday June 18, 2024 @01:55PM (#40720402)
> 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.

There are no comments on this comment yet.