For a good explanation of why it's a good idea to always use semicolons in your JavaScript, take a look at: http://lucumr.pocoo.org/2011/2/6/automatic-semicolon-inserti...
Crockford on Bootstrap's semicolon omission: “insanely stupid code”
21–30 of 224 posts
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#22Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#23Earlier quoted context omitted.
Why the hell people are refusing to use semicolons? I don't get it
Same reason people don't use semi-colons in Python, I imagine. Besides, I'm not willing to acknowledge any reasons for using semi-colons as significant. And without any significant reasons for it, I may as well not use them. Besides, it makes the code prettier :).
1 + 2 * 3
Solves to 7, obviously. But I'll write it in code like this: 1 + (2 * 3)
Just to make it clear that I know what I mean, and I mean do the operations in _this_ order.Similarly, using semicolons to end lines means I am saying loud and clear... this line of code ends HERE.
Obviousness is a good thing, no?
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#24Earlier quoted context omitted.
Is there any particular reason why you refuse to put in the semicolons in Javascript?
There's a whole hipster movement going on right now around the idea of omitting semicolons from JavaScript code. I believe CoffeeScript is the culprit. Personally, I agree with Crockford -- it's dumb.
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#25Earlier quoted context omitted.
Is there any particular reason why you refuse to put in the semicolons in Javascript?
There's a whole hipster movement going on right now around the idea of omitting semicolons from JavaScript code. I believe CoffeeScript is the culprit. Personally, I agree with Crockford -- it's dumb.
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#26Ideally, your goal as a hacker is to make cool shit. Your goal is not syntax.
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#27Earlier quoted context omitted.
I've seen a few reasons. The main ones I encounter are: raising the skill requirement to contribute (you have to know JS better than average to never use a semicolon, and do so correctly), aesthetic (fewer characters looks better), and minimalism (don't use what you don't need).
> raising the skill level to contribute That's insane. Good programmers need not know stupid tiny nits about Javascript (heck, I've worked on a Javascript JIT and I don't really know Javascript). That does not mean that they are not skilled. > aesthetic I don't understand how "you must carefully understand how the language parses to understand this line of code" is aesthetically pleasing when compared to unambiguity.…
In this case, the minifier is breaking the code, regardless.
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#28Crockford's stance is annoying purely because it's pedantic and because there are many libraries that embrace this style. We use django_compressor and found bugs from the compressor that uses Jsmin. So I have to use something else to compress them before hand. Are there compressors that use the syntax tree rather than transforming the source?
Is there any particular reason why you refuse to put in the semicolons in Javascript?
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#29It is a bug on JSMin. Minifying should never alter code behaviour.
Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”
#30> ! is not intended to be a statement separator. ; is. Which is why there is a line break there. He's far too stubborn to realize that JSMin is at fault for not being able to correctly parse JavaScript.