You can also mix approaches: optional semicolons, but use indentation to guess if it’s the same instruction or not. That way:
// 3 instructions
blah; blah
blah
// 2 instructions
blah blah
blah
// 1 instruction (indentation is significant!)
blah blah
blah
// This one is tricky. Id' say syntax error, or a warning
blah; blah
blah
// This looks better, more obvious to me: 2 instructions
blah; blah
blah
// Alternatively, this one may also count for 2 instructions
blah; blah
blah
// begin of a new block
appropriate_keyword blah blah
blah
// end of a block (one instruction in the inner block,
one instruction in the outer block).
blah
blah
// 2 instructions (but frankly, I'd provide a warning for the superfluous ";")
blah;
blah;
This should be flexible enough and unambiguous enough.
In Python, you are supposed to write a colon before you start a block, right?
So the rules can be rather simple:
colon, with indentation = start of a new block
colon, no indentation = an empty block (or a syntax error)
no colon, with indentation = continuing of the previous line
no colon, no indentation = next statement
semicolon = statement boundary
Block ends where the indentation returns to the level of the line that opened the block. Continued line ends when indentation returns to the level of the starting line. (Where “to the level” = to the level, or below the level.)
You can also mix approaches: optional semicolons, but use indentation to guess if it’s the same instruction or not. That way:
This should be flexible enough and unambiguous enough.
In Python, you are supposed to write a colon before you start a block, right?
So the rules can be rather simple:
colon, with indentation = start of a new block
colon, no indentation = an empty block (or a syntax error)
no colon, with indentation = continuing of the previous line
no colon, no indentation = next statement
semicolon = statement boundary
Block ends where the indentation returns to the level of the line that opened the block. Continued line ends when indentation returns to the level of the starting line. (Where “to the level” = to the level, or below the level.)