Bootstrap's maintainer hates the semicolon
41–50 of 137 posts
Re: Bootstrap's maintainer hates the semicolon
#42 return
{ foo: 3 };
do what you expect :)Re: Bootstrap's maintainer hates the semicolon
#43Personal anecdote time: I've been writing Javascript for my job for about 16 months now. When I started, I read all the same material as the readers of this site probably did, mostly written by Crockford, advocating a certain brace/semicolon heavy style. But after dutifully following this for about 6 months, I started to notice that I had made many 'mistakes' in the code, to do with missing semis particularly, and so had a lot of other people in the company. Of course, all the code ran fine everywhere and nobody had noticed in 6 months.
So, when writing code for personal exploration at home, I stopped using semis. It's surprising how much time you spend making sure they are there when the interpreter won't check for their presence (and doesn't care either way). Issues can crop up to do with missing semis, but so far I haven't had a single issue, probably because i'm aware of avoiding certain things, like starting a line with a bracket.
So, in my personal experience, it hasn't mattered to have them or not. If you absolutely need them for minification or similar, you should be using a compiler like yui. You are going to make a mistake if your code base is large enough to matter, irrespective of how vigilant you are, so you might as well leave minutiae like this to a computer.
Re: Bootstrap's maintainer hates the semicolon
#44He wrote a blog post about this a while ago, I don't really get his reasoning but I guess he's happy with his decisions: http://www.wordsbyf.at/2011/10/31/i-dont-write-javascript/
This blog post accurately states the broken idea: > Each is perfectly valid. Each behaves the same. It’s just a matter of preference and finding the style that makes most sense to you. Part of being a good steward to a successful project is realizing that writing code for yourself is a Bad Idea™. If thousands of people are using your code, then write your code for maximum clarity, not your personal preference of how…
Re: Bootstrap's maintainer hates the semicolon
#45I don't get what the issue is. I run bootstrap js through the closure compiler (with minification and optimization) and it works just fine. I don't agree with the policy myself, I prefer semicolon, but I also prefer CoffeeScript. That said, if Fat wants to remove it, that is his choice, leave him alone. Update: Just read his blog posting. If Fat really wanted the minimalist approach, he'd use coffeescript and then pe…
Re: Bootstrap's maintainer hates the semicolon
#46I think this is one of those stylistic preference issues that basically doesn't matter, which is why people will probably go on about it for weeks with no resolution in sight. Personal anecdote time: I've been writing Javascript for my job for about 16 months now. When I started, I read all the same material as the readers of this site probably did, mostly written by Crockford, advocating a certain brace/semicolon he…
Re: Bootstrap's maintainer hates the semicolon
#47Earlier quoted context omitted.
Relying on multiple different parser's implementation of the "auto semicolon insertion guesser" feature seems insane to me. I'm a python/haskell guy too, I hate semicolons. But I'll put up with them because javascript needs them, it doesn't enforce them, but to write sane, maintainable code it really needs them. Javascript is enough of a mess, this kind of thing just throws gas on the fire. Have you published your br…
JavaScript doesn't need them any more than Python does; they're used almost always simply because people don't know the (simple) rules of when statements end.
I know the semicolon insertion rules, because I'm obsessive-compulsive like that. In any team I lead, any software I write, and any open-source project I maintain, the coding standard will be "Terminate all your statements with semicolons."
Why? Because my job is to make less work for people, not more. I could give them a list of 4 rules, often each having a list of a half dozen+ tokens, and say "memorize these, or you're not a professional JavaScript programmer". Or I could say "Terminate your statements with semicolons", and there's one rule, the same as in many other languages, for them to memorize.
Other projects are free to do whatever they want with their coding standards, and if they want to make things complicated to show how 1337 they are or just because they think it looks pretty, fine. But of all the things you need to worry about to be a good frontend engineer, where to put the semicolons seems like the stupidest possible one.
Re: Bootstrap's maintainer hates the semicolon
#48Re: Bootstrap's maintainer hates the semicolon
#49Check out the following issue, not just the matter of style.. https://github.com/twitter/bootstrap/issues/401
Re: Bootstrap's maintainer hates the semicolon
#50Check out the following issue, not just the matter of style.. https://github.com/twitter/bootstrap/issues/401
> The lack of semi-colons in the dropdown js file causes this compression to break
Thanks for the heads up, no bootstrap for me! (At least without something that's going to add the necessary semicolons... I wonder how many HN weekend projects out there simply don't work for people using their wireless connections?)
Also interesting that it appears the issue was closed because it contained the key phrases 'compression' and 'semicolon'... but it was not re-opened even after the maintainer realized the problem is with the wireless providers.