4 ms·
> 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_ sequ
by judofyr 4y ago
> 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_.
- lmm 4y ago> 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.