Nobody really cares one way or another, and while it would take Twitter more time to append changes to their code than it would Crockford, my guess is the trouble for either would be negligible.
That said, this is very obviously a pride war between those who stick to convention and those who undermine it. The question isn't "should we use semicolons", it's "who is going to start dictating the direction Javascript goes from here on out?"
Clearly, both of these individuals want that spot, but if there's anything I've learned in my short time of coding, convention always wins out.
I'm merely explaining why it's drawing so much attention, and what nerves this debate seems to be touching, because as a technical debate it is insanely boring. But that's clearly why it's not strictly a technical debate.
I'd frame it as "a pride war between people wanting a sane codebase not based on fragile parser edge cases --include two that know the language inside out--, and the developer of some minor js code that thinks he's too clever for all that".
That's no "undermining convention", that's juvenile bs. I know who I'd rather have on my team.
The problem is that jsmin is a naive pile of textual replacements (though not quite as abysmal as John Gruber's markdown.pl) instead of being a javascript implementation — something that actually parses javascript into an AST and compiles it to minified javascript.
He left out cases for several unary operators so it broke perfectly valid code. After bitching at them he came to his senses and fixed it: https://github.com/douglascrockford/JSMin/commit/5ca277ea452...
Unless for some reason you need your minifier to be trivial enough to be portable with no dependencies, you should really be using something along the lines of google's Closure Compiler, which produces far better output and even has stuff like tests!
Yes, it worked according to how the parser was designed.
But it depended on a frowned-upon parser feature (AST), that can lead to ambiguous or faulty results in similar cases, and for no good reason. When the creator of the language and its biggest guru disagree with your code style, well, there's no much room for an argument, even if all known implementations work fine with your code.
He also did an idiotic ?: operator abuse instead of a clear "if" in the same exact line. He probably likes silly "succinct code" tricks, which even C people wouldn't touch with a large pole...
I started programming and hacking because i wanted to make something cool and interesting which others would appreciate, not to bicker about something as silly as semicolons. If i wanted to do that, i'd work in retail. When an argument over something so trivial gets to this level, i cannot help but be bored by it.
One side chooses a style that they find aesthetically-pleasing even if it causes issues for some small subset of potential users.
The other side is flabbergasted that someone would be so reckless and argues for the sensible, safe option, which requires simply terminating your lines of code with an extra character, making those few issues for a small subset of potential users vanish instantly.
http://www.wordsbyf.at/2011/10/31/i-dont-write-javascript/
He says he doesn't use semicolons, except that it caused issues for those who concatenation scripts so he adds a semicolon to the end of the js file. But, lo! This causes issues for those who use the following pattern:
(function() {
// Le code
})()
This has the potential to cause syntax errors when you execute two anonymous functions after each other. Instead of adding a semi-colon to the end, he "works around" the issue by abusing JavaScript like so: !function() {
// Le code
}()
For fucks sake indeed! (function() {
// Le code
})()
!function() {
// Le code
}()
YOU'RE RIGHT. I'M HORRIFIED."In any dispute the intensity of feeling is inversely proportional to the value of the issues at stake."
It was interesting for me to learn about the possibility of using that kind of '!' notation in JS, even if it's impenetrable to most other developers. Maybe I'll be able to parse some other hipster's code thanks to this.
But, to suggest that simply removing semicolons constitutes some grand gesture towards readability, simplicity, or something as grandiose as a "minimalist aesthetic," is...beyond absurd.
It is Bike Shedding Qua Bike Shedding.
"We have met the enemy, and he is us."
hahaha - I feel the best use of this thread is that we agree to spawn a series of blog posts debating the most boring debates to hit HN ever. Including sock-puppets to randomly drop surprise left turns like "no you are all wrong, here is why the ocaml vs haskell debate bores me" and "no, the real boredom is the long comment threads in the ongoing 'anarco-socialist' vs 'enlightened-libertarian' viewpoint wars"
:)
Edit: the point is that sometimes arguments seem stupid because we don't always say (or even know) what we really care about.
It amazes me how much time people have spent arguing over this.
When I see an open source library that's not coded in the way I like, I either customize it to my liking or look for alternatives.
The only time I would really care about someone's programming style is when I work with them, otherwise live and let live.
Maybe the next time a language designer contemplates including such a feature as ASI, he/she will remember this furore and reconsider.
It boggles the mind that so many otherwise intelligent people have decided to take the time to form an opinion about semicolons.
But that's what I always do: scan for the interesting bits or move on.