3 ms·
No semicolons in javascript! This is subversive and should be suppressed.
by talleyrand 15y ago
No semicolons in javascript! This is subversive and should be suppressed.
- fritzy 15y agoAll coffeescript all the time! I guess you can't expect much else from a ruby group.
- stephen_mcd 15y agoTheir justification attributes a blog post where the author basically says "don't use tools that will break your code if you omit these syntax features". It encourages people to write code that will break when used by others, dictating the tools they can and can't use. It's the equivalent of a child closing their eyes and sticking their fingers in their ears to magically whisk away the person standing next to them. It's pretty disappointing to see GitHub, a company that a lot of developers (including myself) look up to and will follow, espousing something like this.
- MatthewPhillips 15y agoThey actually don't provide a justification. That blog makes the argument that omitting them is harmless. Neither GitHub nor the blog make an argument for why you should omit them, however.
- stephen_mcd 15y agoYeah you're right. There's no solid reason to do so, in the face of a solid reason not to.
- rtomayko 15y agoDo you use semicolons in Ruby, Python, shell, or other semicolon-less language where semicolons are allowed? If not, what's your justification for omitting them?
- deleted 15y ago[deleted]
- MatthewPhillips 15y agoWhy is a justification needed?
- technomancy 15y agoThe justification is to be idiomatic and match the bulk of existing code.
- mattbriggs 15y agothe only tools that will break your code if you don't use semicolons are so old they shouldn't be used for other reasons. At this point, you should really be using either yui compressor, closure compiler, or uglifyjs for reasons that have nothing to do automatic semi-colon insertion or not. If you are still using something like packer, that bit of advice will take about 5 minutes of work, and give you significant decreasing of file size. Semi-colons need to be in 1 place, the beginning of a line that starts with a (, since that is the one place that automatic semicolon insertion will really screw you. If it makes you feel good to write a semi colon at the end of every line I don't think anyone is stopping you, but it isn't the language or tools that require it. You can also feel free to explicitly wrap every statement in parens (because it is necessary in a few cases), or end each line with a // after your semi-colon, all these are freedoms the language gives you, but are as necessary as semi-colons. I haven't been using unnecessary semi-colons in js for years, and have yet to run into a problem.
- tptacek 15y agoTheir style guide disagrees with mine! KILL THEM ALL!!! Did you read the article they linked to? I did. I still disagree with the style rule, but I don't feel like I'd win an argument with them about it.
- mattbriggs 15y agodailyjs did a nice writeup recently http://dailyjs.com/2012/01/19/semicolons/ http://dailyjs.com/2012/01/19/semicolons/ and isaac (npm guy) wrote a really good piece on it that I like better then mislavs http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding http://blog.izs.me/post/2353458699/an-open-letter-to-javascr.... I don't even have a problem with people who want to put semi-colons all over the place, I am just tired of having to defend myself on why I choose not to. And it feels kind of odd that I have to, because I am not the one adding redundant characters everywhere
- sanderjd 15y agoThe reason you have to defend yourself is that your style is currently less idiomatic than their style. The caveat of non-idiomatic choices is that you have to defend them either indefinitely or until the idioms change, whichever comes first. What I find odd is when people make a non-mainstream choice and aren't willing to put in the effort to back it up - swimming against the stream is great, but you have to be able to explain to people why you're doing it or be tough enough to ignore them when they ask.
- lucisferre 15y agoWhen it comes to arguments about semicolons, there are no winners.