News for hackers. Stuff that matters.
Re:Some Thoughts on Zig by abainbridge on Friday July 22, 2022 @03:05AM (#32189348)
I don't understand why fixing issue 358 in the Zig compiler isn't trivial. I don't understand the reluctance. I don't understand why:

    for (var i: usize = a; i < b; i += 1) { foo(); }
    for (var i: usize = a; i < b; i += 1) { bar(); }
Is worse than:

    var i: usize = a;
    while (i < b) : (i += 1) { foo(); }
    while (i < b) : (i += 1) { bar(); }
Which is what happens without the for-loop scoping of the variable. (ie when I cut and pasted, I introduced a logic bug where I forgot to initialize i for the second loop).
Re:Some Thoughts on Zig by abainbridge on Friday July 22, 2022 @03:09AM (#32189383)
Maybe there is a good reason. I'd just like to know what it is. My guess is that fixing issue 358 with syntactic sugar would mean that the debug info would show scope blocks that don't correspond to {} in the source, and that is annoying.
Re:Some Thoughts on Zig by abainbridge on Saturday July 23, 2022 @02:14AM (#32200853)
I also see that this is a bike-shed issue [1]. It probably isn't as important as some other language issues that are complicated enough that I don't even know about them. However, people's first impression of the language matter, so fixing the bike shed matters.

[1] https://en.wikipedia.org/wiki/Law_of_triviality