Live data from Hacker News

Bootstrap's maintainer hates the semicolon

github.com

31–40 of 137 posts

Re: Bootstrap's maintainer hates the semicolon

#31
post #4

Thanks for drawing my attention to this. Currently, I maintain a separate branch simply for adding the missing semicolons so that I can link the individual bootstrap files with my project. It's been quite annoying and I now know that the annoyance may not go away anytime soon. I hate these ideologues. But this is the trouble with JS I guess. I actually love javascript because of the highly dynamic nature of it. But t…

> I don't know of any other language where people can CHOOSE to follow syntax.

Your argument is incorrect. :) Omitting semicolons is perfectly valid and correct syntax. The spec is explicit about it being allowed and how the code shall be interpreted: http://es5.github.com/

It may be a good rule of thumb to use the semicolons, because you have to be careful without them, but in the end it's a choice based on team preference. If you are a very pertinent and careful type of person, and you don't have any rabid illiterates on your team, going without semicolons makes perfect sense.

Re: Bootstrap's maintainer hates the semicolon

#33

If you're going to use JS, you're not allowed to change things like this. It just causes problems for people. Easy solution, use CoffeeScript and have it compile down to JS. My favorite feature of CoffeeScript is the ruby/python line conventions spacing (2 spaces, no tabs), and no semicolons. They're already compiling the CSS from Less. Seems natural to add CoffeeScript to the chain.

alternatively, use JSLint

Re: Bootstrap's maintainer hates the semicolon

#35
post #32
post #29

This is extremely frustrating. I have to create a special code path for Bootstrap JavaScript because it can't be minimized using the standard tooling that works on everything else.

one could argue that the toolchain sucks if it can't process valid JS

That would also be extremely frustrating if one argued that.

Re: Bootstrap's maintainer hates the semicolon

#37
I don't see it as really a problem. Its just a matter of personal coding preference.

As far as minification and optimization is concerned it works fine using yui, google closure, uglify.js .

(also mentioned by fat in https://github.com/twitter/bootstrap/issues/401#issuecomment...)

Re: Bootstrap's maintainer hates the semicolon

#38
post #33

If you're going to use JS, you're not allowed to change things like this. It just causes problems for people. Easy solution, use CoffeeScript and have it compile down to JS. My favorite feature of CoffeeScript is the ruby/python line conventions spacing (2 spaces, no tabs), and no semicolons. They're already compiling the CSS from Less. Seems natural to add CoffeeScript to the chain.

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.

Re: Bootstrap's maintainer hates the semicolon

#39
post #31
post #4

Thanks for drawing my attention to this. Currently, I maintain a separate branch simply for adding the missing semicolons so that I can link the individual bootstrap files with my project. It's been quite annoying and I now know that the annoyance may not go away anytime soon. I hate these ideologues. But this is the trouble with JS I guess. I actually love javascript because of the highly dynamic nature of it. But t…

> I don't know of any other language where people can CHOOSE to follow syntax. Your argument is incorrect. :) Omitting semicolons is perfectly valid and correct syntax. The spec is explicit about it being allowed and how the code shall be interpreted: http://es5.github.com/ It may be a good rule of thumb to use the semicolons, because you have to be careful without them, but in the end it's a choice based on team pre…

The spec has provisions for automatic semicolon insertion that need to be considered carefully before deciding to completely ignore them. Now consider that http://twitter.github.com/bootstrap/index.html says the following:

"Bootstrap is designed to help people of all skill level—designer or developer, huge nerd or early beginner. Use it as a complete kit or use to start something more complex."

So: 1. "illiterates" are welcome to use it. 2. If the goals are to be met, do not assume anything that can be interpreted differently by different players.

Re: Bootstrap's maintainer hates the semicolon

#40

Earlier quoted context omitted.

You can do it in Ruby and lots of other languages

Ruby, Python, Go, JavaScript, Bash, even Clojure -- kinda. https://gist.github.com/1815639 Of course, unless you're the sole writer and reader of the code, it's generally good to follow the common practices that evolved around the particular language.

Just becuse it is in the language spec does not mean that you should use it - Arithmetic IF's in Fortran are a good example.
Post reply on HN