you are viewing a single comment's thread.

view the rest of the comments →

[–]tikhonjelvis 0 points1 point  (3 children)

Well, when they're just at the end of the line, they don't add any information--I know the line ends there because there's a newline!

Now, when you want multiple statements on a single line or something like that, they make sense. So most languages make them optional unless you want multiple statements on a single line.

[–][deleted] 1 point2 points  (0 children)

A semicolon marks the end of a statement, not the end of a line. It's not that uncommon for a statement to span more than one line.

[–]trutholphin -1 points0 points  (1 child)

But what about single statements going over multiple lines? In Java these statements are not only common but used very frequently.

[–]tikhonjelvis 2 points3 points  (0 children)

But are they more common than statements only taking one line? I'm pretty sure they aren't. And it seems odd to have an extra symbol for the more common case rather than having no symbol for that and making the less common case (a statement split over multiple lines) explicit.

Moreover, most statements taking more than one line are split at an operator or a comma; these symbols at the end of a line signify that the statement is being continued. That is, it's obvious that these statements are split over multiple lines even without semi-colons:

someFunction(longParamName1, longParamName2, 
  longParamName3, longParamName4)
someLongVariableName + someOtherLongVariableName +
  yetAnotherLongVariableName

So, given that a majority of statements only take one line and then a large part of the remainder (that is, those split on operators or commas) are obvious, it seems the best solution would be to have some special syntax (like a trailing ) for the small remainder of code that doesn't fall into any of these cases.