Live data from Hacker News

Bootstrap's maintainer hates the semicolon

github.com

61–70 of 137 posts

Re: Bootstrap's maintainer hates the semicolon

#61
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/

Maybe this kind of reasoning explains why their API is such garbage.

I agree. As some-one who has just finished with a large-ish project using bootstrap, I can say that one of the worst parts of it is its js api.

Re: Bootstrap's maintainer hates the semicolon

#62

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.

Actually, it has nothing to do with ruby. The problem here is that some people use minification tools that rely on semicolons. If that weren't the case, this would be a total non-issue.

Re: Bootstrap's maintainer hates the semicolon

#63

Earlier quoted context omitted.

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.

> Granted, I've never ever encountered these, but still -- it's not as simple as you make it out to be.

There's one and only one of these cases which I've seen (and I'd see) happen: `return`, for users of Allman, while that is completely nutty (just as Allman) some people will write:

    return
    {
        key: value
    };
even though they're defining an object literal not a scope. The result is returning immediately (undefined) and dropping the object in space.

`throw` would be really weird, it may happen with a labelled break or continue but I've yet to see those ever used at all (so a user of these probably wouldn't fuck up the label, plus that label would become a bareword which most static analyzers would trivially see) and postfix operators outside of continuated expressions (e.g. function calls) are unlikely to be split.

I've been bitten more often by not having inserted semicolons than by any of those.

Re: Bootstrap's maintainer hates the semicolon

#64
post #48

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

When things break (and they do) having a stack trace start in the bowels of a minified library is hell. So you'd generally use the "normal" library and the project's minification/concatenation tools.

Even when they handle ASI itself correctly, these tools don't always handle things that nicely across files.

Re: Bootstrap's maintainer hates the semicolon

#65
post #34

Check out the following issue, not just the matter of style.. https://github.com/twitter/bootstrap/issues/401

The reply seems immature from the perspective of project maintenance.

Agreed. Aesthetics should be the first thing to go when they cause real-life issues for what you are making. The only value of the aesthetics of not having semi-colons is to the developer himself.

Re: Bootstrap's maintainer hates the semicolon

#66

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

Well, this is a stylistic preference issue that does matter if it causes issues for people using certain tools or in certain situations (such as the tethering ISP issue).

Re: Bootstrap's maintainer hates the semicolon

#67

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

I 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.

In theory, yes, it doesn't matter. In practice, it does (and YUI, etc. do not fix the problem):

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

Re: Bootstrap's maintainer hates the semicolon

#69
This has bothered me so many times when using Bootstrap. The compressor I mainly use (UglifyJS) handles the compressing alright, but the concat process fails. At least just have a semicolon at the end of all JS files and that's enough for most people.
Post reply on HN