← Back to context

Comment by josefx

4 years ago

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.

    • If you dropped the parentheses around the condition, I think you’d have to make the braces around the body mandatory.

      Many (most?) C style guides make the braces mandatory, but it’d be a big step to actually change the language syntax that way. Tons of existing code would need to be updated. .. although I guess that could be automated!

      2 replies →

    • > One of the few times I get to remember that English is only my second language.

      Most native speakers aren't aware of the terms. They'll call anything by any name.

      There is a significant constituency for "curly brackets {}" and "square brackets []".

      Anyway, there are mistakes you could make that would give you away as a nonnative speaker, but that wasn't one of them.

      1 reply →

    • The GP is only correct in America, and only in formal usage.

      In everyday usage in the UK, I’d wager that most refer to () as brackets, [] as square brackets and {} as curly brackets.

      7 replies →