← Back to context

Comment by OskarS

4 years ago

This is obviously terrible, but my favorite part of this whole thing is the fact that he included the parentheses in the IF/THEN macros, so you didn't have to do it for the condition in the if statement. So, like, this line doesn't need parentheses around the condition:

    IF (n=to-from)<=1 THEN return FI

All modern languages that try and do a refresh on the C style (Rust and Swift notably) do this, it's clearly the right idea. They should just update the C and C++ syntax to make those parentheses optional at this point.

(PS. some people would also recoil at the assignment-as-expression used in that line, but that's just good clean fun!)

They already make them optional for single nested statements, which causes a gigantic mess when you extend code and forget to add them.

   if (a)
       doThis();
       andThat();

is interpreted as

    if(a){
      doThis();
    }
    andThat();

Some compilers are nice enough to throw around misleading indentation warnings, but without an explicit block termination like FI this just causes issues all over the place.

  • he meant making the (a) part optional to make "if a" instead. parenthesis are (), {} are braces :)

    • One of the few times I get to remember that English is only my second language. Can't really think of a reason for not dropping them unless there is a weird corner case in the existing grammar.

      13 replies →