#2 Semicolons

brian Tue 6 Dec 2005

I'm thinking that semicolons are optional if the statement ends with a newline or end brace. But could still be used, especially to put multiple statements on one line.

Int foo() { return a + b }

Bool foo()
{
  if (compute())
    return true
  else
   return false
}

It just looks so much cleaner, and they don't really add much value to the grammar. I say we make our Fan coding convention never to use semicolons unless putting statements on one line, so that it becomes the standard convention (our conventions will set the precendence).

andy Tue 6 Dec 2005

I have mixed feelings about that. I think I would have to play with it first.

john Tue 6 Dec 2005

It looks nice, but semicolons will definitely be a hard habit to break.

brian Tue 6 Dec 2005

Since I don't hear any strong objections, I will make it so. I think it's going to be nice.

brian Thu 8 Dec 2005

I've checked this change in. Statements can end with:

  • semicolon
  • newline
  • end of block: }

Login or Signup to reply.