Live data from Hacker News

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

github.com

91–100 of 224 posts

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

#92

Crockford'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?

uglifyjs and closure compiler seem to be totally safe.

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

#93

Earlier 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.

> I believe CoffeeScript is the culprit.

CoffeeScript removes semicolons from CoffeeScript, not JavaScript.

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

#94

Frankly this is less about semicolons and more about two people who both have strong opinions and feel that they need to act in a certain way. It doesn't take a lot more effort to rephrase fat's response to be more cordial. "Hi @englishextra, those two lines are valid JavaScript. We try not to use semicolons whey they aren't necessary. See (insert link to the wiki). "JSMin doesn't perform well on bits of JS like this…

I agree. The real problem here is the complete lack of courtesy from either party. Software developers seem to have problems with this, maybe because we spend so much time commanding machines to do things with brief statements without the even the least bit of a please or thank you.

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

#95
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…

What's wrong with it? It's like arguing about grammar. We've been going back and forth on the Oxford Comma for at least 300 years now, with no end in sight.

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

#96
Wow, I had no idea "asi" (automatic semicolon insertion) was a thing. Describing it as "hipster" is pretty much spot on (IMHO).

I think this makes a great negative filter for interviewing actually:

Q: How do you feel about using line-breaks and other obscure JS rules to avoid putting in semi-colons?

A1: That's idiotic (interview progresses)

A2: Great idea (rejected)

That may sound harsh but here's my complaint: working with other programmers means writing code that's easily understood. Syntactic tricks to reduce the character count for a couple of dozen as an artificial barrier to entry shows me that you are far more concerned with mental masturbation and "Javascript elitism" than the needs of the project or your coworkers. Bad culture fit.

User fat ("Jacob") is a perfect example of this.

Crockford could've handled this better but honestly I sympathize with his frustration. Just because something is possible doesn't make it a good idea. You can technically drive a car with no seat belt using nothing but your feet but that doesn't mean you should.

At the end of the day this is a bug in JSMin but how much exactly should one cater for pathological edge cases (which I consider this to be)?

It's all about readability. Sometimes you put parentheses around arithmetic expression to make it clear what's happening, not because it's required. You put a semi-colon after each statement because it's clear.

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

#97
post #81

Earlier quoted context omitted.

But as of now it's not.

! 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.

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

#98
post #85

Earlier quoted context omitted.

The 'latest revision of the future specification' you link to is, I think, the set of things the TC39 group has considered and agreed on. The list of things they are currently considering is in the strawman namespace[1] on that wiki. In particular, the "strawman:concurrency" page[2] currently says: The infix “!” operator: An eventual analog of “.“, for making eventual requests look more like immediate requests. [1]:…

[deleted]

> But... surely that code is far more "insanely stupid[-looking]" than the first...?

I don't think anyone is arguing that x\n!p is a good way to write code. Crockford is pointing out that ASI will not occur when ! is an infix operator.

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

#99
post #88
post #86

Earlier quoted context omitted.

I'm uninterested in any specifics, actually; I'm more interested in how much of the syntax landscape is cut off for future extension, particularly at the expression level. It's one thing to insert semicolons in this case: and another to do so in this kind of case: The former is unlikely to be problematic for future extension, but the latter more so. The general pattern in Algol-derived languages is for all statements…

[deleted]

No, we should not. We should look at principles, because principles are what guide us on judging specifics.

If you don't understand why I take this approach, you will never understand my position.

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

#100

Earlier quoted context omitted.

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.

Kind of funny that you say this, since CoffeeScript inserts semicolons. The lack of semicolons is the one major thing in the Github style guide that I think is stupid. It seems silly to avoid using semicolons in Javascript because it actually takes a little bit more effort than just using them.

On my team we've decided to use semi-colons in JavaScript for this exact reason: It would actually take more effort to stop using them as our other major language is PHP. More effort for no benefit is pointless.
Post reply on HN