3 ms·
Dropped semicolons about 6 months ago and haven't had a problem even once. Once you get into the habit, it requires zero extra effort. You just know when to pu
by secoif 15y ago
Dropped semicolons about 6 months ago and haven't had a problem even once.
Once you get into the habit, it requires zero extra effort. You just know when to put them in, same way you just know when to use parens vs curlies.
Coding with semis is like coding with parens around every expression; unnecessary and paranoid.
- alttag 15y ago> Coding with semis is like coding with parens around every expression; > unnecessary and paranoid. Unless, of course, one is using Scheme or some other Lisp variant.
- 54mf 15y agoGood thing it's a Javascript style guide, huh? ;)
- alttag 15y agoIt was the "unnecessary and paranoid" bit that really turned me off. Flaming everyone who doesn't use the same style wasn't warranted, IMNSHO. I responded with snark. I think in general the answer may be to use the style that mimics the other code in the application. Rubyists may prefer the newline endings; those using Java or PHP may find having the semi-colon more comfortable. Having less contextual switch between languages may be easier. Such a sweeping statement seemed a bit ridiculous. Choosing to interpret it in a broader context was intended to highlight my opinion of the original statement. EDIT: It's been fun watching the mod of the GP go up and down ... zero, back to one, then to zero ... over and over.
- secoif 15y agoIt's unnecessary because apps continue to work with little to no modification without semis, it's paranoid because all of the reasons people come up with for why semicolons are important (lint tools? minifiers? bugs?), are all non-problems if you spend a few minutes changing your habits.
- dos1 15y agoBut why? Why drop the semicolons? What is the benefit? If the net result is exactly the same, why try and be tricky? What is the point, other than you can do it. But there are many tricky things we can do with programming languages, but very few we should
- true_religion 15y agoHe never said the net result was the same. He said that there were no problems. No problems doesn't imply no benefits.
- viscanti 15y agoOn a team of a sufficient size, dropping semicolons hurts. Someone will be running a static analysis "lint" program in their editor, and it will always flag those missing semicolons. That certainly adds additional cognitive friction to those users, who constantly see the reminder to add the missing semicolon. I guess I've never understood the argument for omitting them. It seems like an unnecessary trick. Coding guidelines should enforce the simplest possible patterns and techniques.
- secoif 15y agoUnlikely the default lint options are going to suit all teams anyway. JSLint/JSHint can, and should be configured for your team's style.
- secoif 15y agoThe point is to reduce noise. JavaScript already has a lot of cruft going on with all its anonymous functions, parens and curlies… anything to reduce the signal to noise ratio is a step in the right direction.
- lucisferre 15y agoIf you really cared about that you would use coffee script. Dropping semicolons is such a triviality.