Am I the only one who now won't consider using Bootstrap for a project (based on this semicolon issue)?
Bootstrap's maintainer hates the semicolon
81–90 of 137 posts
Re: Bootstrap's maintainer hates the semicolon
#82He 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/
Replying to myself because I decided I have more to say: Imagine if a coder wrote a big huffy blog post declaring that he was only going to use single-character variables everywhere because it was more "minimalist" than using descriptive variables. He'd be hanged. Obviously what "fat" is deciding to do with semicolons is less annoying than the strawman I just made up, but I don't think it's entirely dissimilar. The J…
Re: Bootstrap's maintainer hates the semicolon
#83I 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.
It's just embracing the ASI. Nothing wrong with it. On the contrary, the understanding necessary to use it implies good knowledge of the language.
Re: Bootstrap's maintainer hates the semicolon
#84 var x = function() {
// something
}
// avoid polluting global scope:
(function() {
// Some initialization.
})()
This will call the function x with the anonymous function as its argument, and then call the result of that.There are more examples to that point, and many of them really aren't all that straightforward. So don't rely on automatic semicolons.
Re: Bootstrap's maintainer hates the semicolon
#85Earlier quoted context omitted.
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…
Leaving semi-colons out is not clever, it's just understanding where you need them instead of shooting blindly.
Re: Bootstrap's maintainer hates the semicolon
#86Thanks for drawing my attention to this. Am I the only one who now won't consider using Bootstrap for a project (based on this semicolon issue)?
Or at least, I would still use bootstrap even if I had to throw out all of the js.
Re: Bootstrap's maintainer hates the semicolon
#87I 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…
Nobody's forcing anyone to use Bootstrap nor is anyone prevented from creating their own Bootstrap fork with semicolons.
Clearly, no good deed goes unpunished.
Re: Bootstrap's maintainer hates the semicolon
#88Not having to use semicolons sounds nice, but in practice it can have terrible effects. E.g.: var x = function() { // something } // avoid polluting global scope: (function() { // Some initialization. })() This will call the function x with the anonymous function as its argument, and then call the result of that. There are more examples to that point, and many of them really aren't all that straightforward. So don't…
var x = function() {
// something
}
// avoid polluting global scope:
!function() {
// Some initialization.
}()Re: Bootstrap's maintainer hates the semicolon
#89Not having to use semicolons sounds nice, but in practice it can have terrible effects. E.g.: var x = function() { // something } // avoid polluting global scope: (function() { // Some initialization. })() This will call the function x with the anonymous function as its argument, and then call the result of that. There are more examples to that point, and many of them really aren't all that straightforward. So don't…
You can write this without any problem: var x = function() { // something } // avoid polluting global scope: !function() { // Some initialization. }()
Better or worse?
Re: Bootstrap's maintainer hates the semicolon
#90Earlier quoted context omitted.
You can write this without any problem: var x = function() { // something } // avoid polluting global scope: !function() { // Some initialization. }()
So now you've gone from a semicolon, which has the sole purpose of separating statements; to a bang, which doesn't make any sense in this context unless you know that it's replacing a semicolon. Better or worse?
;function() {
// Some initialization.
}()
void function() {
// Some initialization.
}()