Re:Why are programmers afraid of not using semicolons in Jav...
by einaregilsson on Sunday August 07, 2011 @12:54PM
(#2857038)
Yes, the two cases where I actually think I could run into that are that and
var x = i
(function() {...})()
where it wil think i( is a function call.
Re:Why are programmers afraid of not using semicolons in Jav...
by sjs on Sunday August 07, 2011 @01:57PM
(#2857237)
The informal and single easy rule is to prefix lines that begin with punctuation with a semi. In practice only [ and ( crop up, almost nobody begins lines with a prefix increment or decrement. If you use += 1 and -= 1 instead you sidestep that case.
Re:Why are programmers afraid of not using semicolons in Jav...
by felipemnoa on Sunday August 07, 2011 @02:02PM
(#2857252)
Or, you could just add a semicolon. KISS at work.
Re:Why are programmers afraid of not using semicolons in Jav...
by einaregilsson on Sunday August 07, 2011 @02:27PM
(#2857329)
Yes, you could just add a semicolon in front of lines that start with punctuation (tiny percentage of all lines) or you could just stick them at the end of every single line...
Re:Why are programmers afraid of not using semicolons in Jav...
by eropple on Sunday August 07, 2011 @02:32PM
(#2857348)
Yes, you could put them at the end of every statement. Because consistency is a good thing.
Re:Why are programmers afraid of not using semicolons in Jav...
by einaregilsson on Sunday August 07, 2011 @02:41PM
(#2857374)
@eropple: So you put semicolons after every line? Even after block statements {} ? Why not, if the goal is to be consistent?
Re:Why are programmers afraid of not using semicolons in Jav...
by burgerbrain on Sunday August 07, 2011 @03:32PM
(#2857506)
You should use the reply button.
Re:Why are programmers afraid of not using semicolons in Jav...
by einaregilsson on Sunday August 07, 2011 @04:39PM
(#2857666)
It wasn't visible for me on that one comment. I don't know why, I thought it was too deply nested or something, but now I see it. Weird.
Source: http://blog.izs.me/post/2353458699/an-open-letter-to-javascr...