This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Learning from others about semi-colons :)
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Mark Igra is looking to others to help make decisions and learn:
The term semicolon insertion informally refers to the ability to write programs while omitting semicolons between statements. In both ECMAScript 3 and ECMAScript 4 there are two kinds of semicolon insertion:
Grammatical Semicolon Insertion
Semicolons before a closing } and the end of the program are optional in both ECMAScript 3 and 2.0. In addition, the ECMAScript 4 parser allows semicolons to be omitted before the else of an if-else statement and before the while of a do-while statement.
Line-Break Semicolon Insertion
If the first through the nth tokens of an ECMAScript program form are grammatically valid but the first through the n+1st tokens are not and there is a line break between the nth tokens and the n+1st tokens, then the parser tries to parse the program again after inserting a VirtualSemicolon token between the nth and the n+1st tokens.
Grammatical semicolon insertion is implemented directly by the syntactic grammar's productions, which simply do not require a semicolon in the aforementioned cases. Line breaks in the source code are not relevant to grammatical semicolon insertion.
Line-break semicolon insertion cannot be easily implemented in the syntactic grammar. This kind of semicolon insertion turns a syntactically incorrect program into a correct program and relies on line breaks in the source code.
After working in languages that don't require;
putting semi colons;
at the end;
of;
statement;
It is nice to have the option to not have too;
As long as:
a) it is implementable
b) it doesn't cause other horrible things to happen in the language just to make it implementable.
NOTE: I can understand reasons why you may like semi colons (history, java, periods in language). This is one of those personal feel things for me.