Live data from Hacker News

Bootstrap's maintainer hates the semicolon

github.com

51–60 of 137 posts

Re: Bootstrap's maintainer hates the semicolon

#53
post #48

Stupid question maybe but what's wrong with the included bootstrap.min.js? What am I missing?

Basically, people don't want the minified versions of files while they're developing, and there will always be people coming to the project with whatever minification tools in their build that can't handle the missing semicolons. Currently, the answer is "change your build tools".

https://github.com/twitter/bootstrap/issues/1795

Re: Bootstrap's maintainer hates the semicolon

#54
post #33

Earlier quoted context omitted.

alternatively, use JSLint

I much prefer JSHint. JSLint is draconian, and has some borderline insane decisions (it complains if you don't declare your vars at the top of a block—is this 1980?). And yes, I realise that some of these options can be turned off —but JSHint has better defaults.

There is a reason for the insanity you are complaining about. The vars are effectively hoisted there by the interpreter anyway, by pulling them to the top of the block you remove a possible point of confusion, and more importantly a possible point of bugs.

Re: Bootstrap's maintainer hates the semicolon

#55
post #9

He 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 is utterly stupid. And the example he cites for why he prefers an odd function syntax doesn't cause errors..... if you use semicolons.

JavaScript interpreters insert semicolons. If you abuse this, you'll end up with unpredictable results like his function example.

Re: Bootstrap's maintainer hates the semicolon

#56
post #17
post #9

He 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…

It is a valuable and documented code quality. http://en.wikipedia.org/wiki/Principle_of_least_astonishment

Principle of least astonishment (POLA) was also a core design decision behind ruby. http://en.wikipedia.org/wiki/Ruby_(programming_language)#Phi...

Re: Bootstrap's maintainer hates the semicolon

#57
I wouldn't see any significant problem with a policy of omitting semi-colons when there's no risk of ambiguity, but turning the omission of semi-colons into a religion? That's enough to make me question what other nutty peculiarities exist in his coding philosophy, and therefore whether I'd dare risk my own projects using his library.

Re: Bootstrap's maintainer hates the semicolon

#59

problem here is ruby.ruby developers hate semicolons. They ignore the decades old history opf the semicolon, and assert that the ruby/python/haskell way of indentation and semicolon-less code is the better way. They COULD be right, but im too deep seated in C/C++/Java/JS. One of the problems with javascript is the fact that it gives the choice.

Agreed.

The first language I learned was VB6 (ewww), after that C, C++, Java, JavaScript and PHP, only a few years ago I started to hear a lot about Python, Ruby, etc.

I don't see what's the problem with the braces and semicolons, I got used to write them and I don't see it affect my coding speed or code readability, in fact I find it easier to read code with braces and semicolons, I learned a little of python a few months ago and ignoring the fact that I do not know the language syntax very well (or more common libraries) yet, I write it as quickly as I would write Java/C etc, for readability I read python slower but as I said I'm not used to the syntax/libraries/etc yet so that may be the problem.

Re: Bootstrap's maintainer hates the semicolon

#60
post #26

Earlier quoted context omitted.

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.

Or because people simply don't want to have to think about 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,…

Please read http://blog.izs.me/post/2353458699/an-open-letter-to-javascr... again, especially the restricted production part. Using semicolons everywhere doesn't cover your ass in those cases. Granted, I've never ever encountered these, but still -- it's not as simple as you make it out to be.
Post reply on HN