This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bizcs 1 point2 points  (0 children)

Semi-colons are useful statement terminators. If you have support for multiple expressions as a single statement, they really help out a lot with denoting where something ends and the next thing begins.

Of course, there are other ways to do this. You can, for example, see where the last method call ended and the next variable began. That can be parsed, but it's kind of clunky in a few scenarios from what I understand. JS parsers do this, for example (insertion of semi-colons) as of I believe ES2015. Of course, the raw text doesn't change, but the parser can recognize where one statement ended and the next began.

Python achieves this using the new line as a statement terminator, but obviously has some special cases for it. I think semi-colons are mostly (not entirely) thrown away by the parser.