You don't seem to have any knowledge about the history of programming languages. There have been several lines of PL syntaxes since the 50s.
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.
> 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.
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.
> so it's kinda hard to complain that it isn't readable
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.
But it's not a 1-by-1 mapping. The FOR-loops of FORTRAN, ALGOL, and Pascal have 1-to-1 mapping to the sigma notation because the increment part is either a) omitted entirely and forced to be +1; b) allowed to be some other integer constant, but definitely not an integer expression.
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?
My argument is that there is no 1:1 mapping: for instance, "for (i=0, j=10; s[i]; t[j--] = s[i++])" has no direct correspondence with sigma notation. Does it? I don't believe so. This code also has no direct correspondence to Pascal's FOR or FORTRAN's DO, or ALGOL's FOR-STEP loops. Hence, C's for loop has no 1:1 mapping to sigma notation.
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.
> My argument is that there is no 1:1 mapping: for instance, "for (i=0, j=10; s[i]; t[j--] = s[i++])" has no direct correspondence with sigma notation.
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.