I wouldn't go as far as calling someone crazy for thinking C-style for loops are good.
The expressions in a C-style for loop is a 1:1 mapping to sigma notation, so is intuitively understood by anyone who has done high school mathematics, even if they didn't realise there's a 1:1 mapping.
Maybe you'd like something different, but it's been a staple of mathematicians for centuries now, so it's kinda hard to complain that it isn't readable.
Easy to make mistakes? Sure!
Hard to read and/or write? Only if you have never seen sigma notation before.
Hum, no, it's very easy.
Almost all of mathematics was created without any care for readability. Mathematicians working with structures that take more than a couple of lines is a very new phenomenon, and the culture of the area didn't even fully adapt yet.
FOR i := 1 TO 10 DO ...
FOR i := 20 STEP -2 UNTIL 0 DO ...
for (i=0, j=10; s[i]; t[j--] = s[i++]); // huh?If you need to mischaracterise and mislead with your examples, you probably don't have a a good argument.
The equivalent C code to your other examples are:
for (i = 1; i <= 10; i++) { ... }
for (i = 20; i >= 0; i -= 2) { ... }
Your argument makes less sense when you write the counter-example out correctly, see?Of course, I can be mistaken and either there actually is a 1:1 mapping, or you meant by "1:1 mapping" something quite different from what I mean.
And? I didn't claim that all the multi-expression, body-in-the-conditional possibilities are a 1:1 mapping with sigma notation, did I?
Why do you think this is more representative of for loops in C than simpler examples I gave?
> or you meant by "1:1 mapping" something quite different from what I mean.
Well, yes. I meant that the 1:1 mapping is from sigma notation to C, not the other way around, because sigma notation was not invented after the C language.
Maybe I shouldn't have said 1:1 mapping; it's much clearer to say "The `for` loop in C is just a way to write sigma notation in programming languages".
“We are having the same ridiculous heated arguments about syntax that programmers have over and over and over so wink I’ll use hyperbolic rhetoric to insult people and wink you shouldn’t take my words to mean very much.”
I find it tiresome. It’s excusable by youth and something that people should grow out of but some never do.
You are crazy if you think that a C style for loop is good designed. It's way to powerful but terse and obtuse to do correctly beyond the simplest application.
C style syntax as a whole is also nothing special if you mean semicolons and braces.
If you include stupid design decisions like braceless blocks in "C style syntax" I wouldn't even know what to think of that opinion.