News for hackers. Stuff that matters.
Re:Zig's Curious Multi-Sequence for Loops by judofyr on Monday February 27, 2023 @01:08PM (#34959827)
> Except it's not "just" a for loop, it's a weird special case for a for loop.

You could also argue that a for loop which can only iterate over a _single_ sequence is a special case of a multi-sequence for loop.

> And one which is actively dangerous too.

In safe builds (ReleaseSafe, Debug) it will cause a controlled panic if the sequences are not of the same size. Most likely it's a logical bug if you iterate over two sequences of different sizes. In ReleaseFast the compiler will make assumptions to improve performance. If it's very important for your code you can force a certain code block to always have runtime safety. Yes, there are trade-offs, but I don't feel it's _unreasonable_.

Re:Zig's Curious Multi-Sequence for Loops by lmm on Monday February 27, 2023 @08:57PM (#34964721)
> You could also argue that a for loop which can only iterate over a _single_ sequence is a special case of a multi-sequence for loop.

When a "for loop" in virtually every language is not multi-sequence, not really. People expect a "for loop" to be a certain kind of thing.