Stupid Question 148: Why the love for semicolons in so many programming languages?
Why the love for semicolons in so many programming languages?
I know somebody is tempted to slap me right know, so I’ll make sure to comment that there is a great deal of semicolon hate as well. Nonetheless, this little symbol seems to be rather important, but why a semicolon (and not something else), and why anything at all?
I was hoping for a quick google/bing and a quick answer. But nope. For a tiny symbol it sure seems to be complicated.
Let’s answer the easy part first: why in so many languages?
Languages are based on other languages, and they often keep the way of creating closures and the use of statement terminators. Who the grandpa of all this was I really don’t know.
Why a statement terminator?
Well, you need to break down bits and pieces of instructions, and to be able to do that you need to notify when a statement has terminated. Most programming languages have conventions for statement separation, termination and line continuation.
Why a semicolon?
Some use carriage return, some use brackets and some use the semicolon (and so on). Why exactly the semicolon I actually don’t know, some theories about the grammatical use of it in the English language, where it is on a keyboard, and some theories about its visibility in text, and it doesn’t conflict with other symbols used (so it was the left-over symbol?? Tragic!). Maybe a combination of them all?
While terminal marks (i.e., full stops, exclamation marks, and question marks) mark the end of a sentence, the comma, semicolon and colon are normally sentence internal, making them secondary boundary marks. The semicolon falls between terminal marks and the comma; its strength is equal to that of the colon
Nonetheless the semicolon, loved and hated, will probably not disappear anytime soon. I don’t mind it, but I’m used to using it and when programming in languages that don’t require it I’m left partially confused. It gives me comfort, but I’m not sure if anything more :)
Last modified on 2013-02-12