Live data from Hacker News

Crockford on Bootstrap's semicolon omission: “insanely stupid code”

github.com

201–210 of 224 posts

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#201
“…Explicit is better than implicit… Readability counts… In the face of ambiguity, refuse the temptation to guess. There should be one—and preferably only one—obvious way to do it…” — The Zen of Python

Ironically, the Zen of Python supports using semicolons in JavaScript. Also, both sides come off like children, but at least Crockford's opinion seems a little less selfish. It's like politics, with the difference being in their premises so they'll never agree.

Also, why can't I (or anyone else) resist commenting on this rather pointless debate? I am disappointed in my weakness.

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#202
post #198

Earlier quoted context omitted.

While the virtues of semicolon insertion are highly debatable, developers are permitted by the ECMAScript standard to write code that relies on it. A tool like JSMin should be aware of semicolon insertion. ricardobeat put it very well elsewhere in this thread: "It is a bug on JSMin. Minifying should never alter code behaviour."

Actually JSMin is aware of semicolon insertion and handles it correctly. They just disagree on whether a semicolon gets inserted here.

Unfortunately for JSMin, browsers attempt to implement at least the ECMAScript specification, not just "the good parts."

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#203

Earlier quoted context omitted.

Is there any particular reason why you refuse to put in the semicolons in Javascript?

Hey everyone, I've just learned to drive without wearing a seatbelt. It's possible! The laws of physics allow it!

Driving without a seatbelt would be perfectly reasonable if I had a written list of all possible accidents to drive around. The twist here is that the one and only grammar change that could break this code may actually happen soon. Until then, though, the code is valid and Crockford is intentionally leaving a bug in jsmin.

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#204
post #33

There's something horribly wrong with everything about this. Why is such a smart person as Crockford wasting his time arguing about semicolons in 2012? Why is this at the top of the most popular hacker website? Why are people writing detailed opinions about semicolons in this thread (with surely more to come?) One would hope that at least over time the bike sheds being argued about would start to at least evolve into…

Whilst fat doesn't come off great he has youth and inexperience on his side.

Someone like Crockford with his 'years of experience' opening the debate by saying this kid's code is 'insanely stupid' is the real disappointment for me here.

Not to mention the memes and pictures being posted further down in the thread. I hope it's a matter of time before github comes up with a way to flag these.

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#205
post #33

There's something horribly wrong with everything about this. Why is such a smart person as Crockford wasting his time arguing about semicolons in 2012? Why is this at the top of the most popular hacker website? Why are people writing detailed opinions about semicolons in this thread (with surely more to come?) One would hope that at least over time the bike sheds being argued about would start to at least evolve into…

>There's something horribly wrong with everything about this. Why is such a smart person as Crockford wasting his time arguing about semicolons in 2012? The disturbing thing is the idiot arguing about implicit semicolons in a language with not good support for them, in a general use library.

Thanks for the donwvoting, at least Brendan Eich and Douglas Cockford agree with me...

http://brendaneich.com/2012/04/the-infernal-semicolon/

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#206
post #131

Excellent - another internet cock-fight, with both sides managing to act like total cocks.. What would be better is for both sides to fix their code: Crockford to fix minify for the edge cases like this (result: better, more robust code equals a win), and the twitter boys to add a semicolon for these edge cases (result: better, more robust code equals a win). But instead, as usual on the internet, it's just devolving…

Crockford won't "fix" minify, because it's much easier to make JSMin work for a safe subset of JS than it is to make it work for all of JS.

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#207
post #185

Earlier quoted context omitted.

http://blog.izs.me/post/2353458699/an-open-letter-to-javascr... That is a pretty good rundown of the rules. The only problem with not having semicolons is cases like this, where someone is using a bad tool to minify your code. None of the tools that currently do the best job will break on that code.

Yes, tool writers need to understand this behavior and handle it. But I still don't understand why the hell you would want to do this. These are a lot of rules to remember, and I don't think it makes sense to think about them for each statement I write. Nothing here says "here is what you gain with this technique", all I see is "it's perfectly valid so quit whining". This doesn't satisfy my curiosity. Then we have th…

starting a line with a semicolon means "start a new expression", if it is done where it is meaningful. By putting it at the start of the line, it is easier to associate it with the statement that makes the character important, and calls out that you are paying attention to one of the biggest gotchas in the language

putting a semicolon at the end of every line is basically just noise. You get used to it, and I find semi-colon bugs end up happening much more frequently. More then that, you are essentially just typing an arbitrary character 99.99999% of the time. When you need a semi colon is essentially a corner case, so the vast majority of code is just getting appended with a character which has no meaning.

Its like the javascript community decided to surround all expressions with parens, since it makes things more explicit, and there are a few cases (much more common then semi colons) where you need it in the language. Or if they decided to end all lines with //, just in case someone wanted to follow it with a comment. Those two examples make as much sense as advocating semicolons at the end of each line.

Re: Crockford on Bootstrap's semicolon omission: “insanely stupid code”

#209

Should JSMin being enforcing the spec or good practice? My vote: Good practice Upvote replies to vote. Please don't down vote the replies so we get a clear picture.

This isn't a legitimate HN poll, just a set of ordinary comments; please don't give undeserved karma for this abuse.
Post reply on HN