Live data from Hacker News

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

github.com

111–120 of 224 posts

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

#111

It is a bug on JSMin. Minifying should never alter code behaviour.

The minification isn't breaking the code. The authors had an incorrect expectation of how JSMin would minify the code. By the very act of minifying code where new lines matter your are always potentially changing the behavior.

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

#114
post #112

If there is a tool to insert semicolons in all the right places, you could use that before using jsmin. Would that help?

The problem from my reading of it is that "all the right places" changes meaning depending on which specification of JS you're talking about. But yes it would work if you run into the problem and the semicolon-inserter targets the right spec.

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

#115
post #49

Earlier quoted context omitted.

Jacob ("fat") comes off looking far worse than Crockford, to my eyes (and that Kit character seems to be 7 years old). It's the arrogance and stupidity of youth facing the crotchety crankiness of experience. Crockford has earned the right to have a strong opinion here IMO. But it's not just bike-shedding. It's more pernicious than that. It's actually something that looks like bike-shedding to uninformed observers, bu…

I have never written a line of JS in my life, which hopefully qualifies me as an unbiased outsider, but I don't agree that that Crockford's position here on JSMin is the right thing to do. Here is what I see: @fat is not inserting "!" needlessly as a statement separator. The "!" is there for its proper purpose, as a "unary not" operation, which will short circuit the second operand of the "&&" when isActive is false.…

Here is what you're missing.

Language lawyering is fine and dandy when you know exactly which compiler will be used and you know exactly how it works.

But on the web that isn't the case. You can write code, but you have no control over what browsers, past, present and future, it will get run on. And it is your responsibility to make that work. According to the spec, you may be right. But in practice you're the one who is wrong, because you're the one whose job it is to make your code work across browsers and future versions of the spec.

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

#116

Earlier quoted context omitted.

! is already being discussed to be turned into an infix operator in a future version of JavaScript.

Future versions of JavaScript might also replace the 'function' keyword with a picture of a chicken, but I'm still going to keep typing the word 'function' for now.

That's not under active discussion. ! as an infix is.

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

#117
post #29

Earlier quoted context omitted.

[deleted]

So you think it's ok for a minifier to break working code? Please explain.

Read the bit about TC39. "This code will break in the future." There's no point in patching the minifier to support this when the patch will have to be reverted pretty soon anyway.

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

#118
post #115

Earlier quoted context omitted.

I have never written a line of JS in my life, which hopefully qualifies me as an unbiased outsider, but I don't agree that that Crockford's position here on JSMin is the right thing to do. Here is what I see: @fat is not inserting "!" needlessly as a statement separator. The "!" is there for its proper purpose, as a "unary not" operation, which will short circuit the second operand of the "&&" when isActive is false.…

Here is what you're missing. Language lawyering is fine and dandy when you know exactly which compiler will be used and you know exactly how it works. But on the web that isn't the case. You can write code, but you have no control over what browsers, past, present and future, it will get run on. And it is your responsibility to make that work. According to the spec, you may be right. But in practice you're the one wh…

In this case, it's not language lawyering. All JavaScript environments "do the right thing" with regards to ASI -- it works in all target environments as of the present day. JSMin is not a target environment, it is a minifier that happens to express some strongly-held opinions of its author.

That said, it's hard to program to a spec that does not (officially) exist yet, and doubly so if there's not clear "opt-in/out" path for future versions. Since, as a developer, I can't control what the committee adds or removes from the spec, or what they might break, I can only do the best I can with the language as it is -- not breaking existing code in future versions of the language is the committee's job.

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

#119
post #109
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…

I found the whole discussion quite sad, the stupid animated GIFs in particular. I became even more sad when I noticed the discussion is being held on GitHub, not Reddit or 4chan. Scrolled through, won't participate. I'd much rather build interesting application.

I wonder when bug tracking sites are going to block reddit referrers (or just prevent them from posting). I've seen this before in comments to PHP bugs and bugzilla bugs.

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

#120
Jacob is an idiot for writing code with a ridiculous fragile syntax that takes more effort to write in a vain effort to obtain "coolness" via winning a pointless language war that nobody on earth cares about.

Crockford is an idiot for writing an JS minifier which explicitly promises to not break legal code but actually does, and then refusing to fix it because he's proud of his reputation for being an asshole.

And everyone commenting on this post is an idiot for thinking that any of this is worth the pixels it takes to argue about it. And yes, that includes me.

sigh This whole thing just makes my head hurt.

Post reply on HN