Live data from Hacker News

Bootstrap's maintainer hates the semicolon

github.com

131–137 of 137 posts

Re: Bootstrap's maintainer hates the semicolon

#131
post #67

I think this is one of those stylistic preference issues that basically doesn't matter, which is why people will probably go on about it for weeks with no resolution in sight. Personal anecdote time: I've been writing Javascript for my job for about 16 months now. When I started, I read all the same material as the readers of this site probably did, mostly written by Crockford, advocating a certain brace/semicolon he…

I think this is one of those stylistic preference issues that basically doesn't matter, which is why people will probably go on about it for weeks with no resolution in sight. In theory, yes, it doesn't matter. In practice, it does (and YUI, etc. do not fix the problem): https://github.com/twitter/bootstrap/issues/401

I don't see how this is the original authors problem actually, regardless of the cause. Someones incorrectly written code injected into your own runtime environment could cause all sorts of weird problems.

IMO this is a reasonably serious browser security issue along the same lines as CORS, but thats another argument.

Re: Bootstrap's maintainer hates the semicolon

#132

Earlier quoted context omitted.

Thanks for the kind words. I've been writing javascript like this for more than a year without any trouble. It's not confusing at all, you just need to sit for 5 minutes and understand ASI. I'd bet with confidence that 90% of programmers out there don't know if a semicolon is needed after a function declaration. They just put it in there blindly, then some day they find a bug because they "forgot" a semi-colon somewh…

I understand JS just fine, and I know where semicolons are needed and where they aren't. But minimalism is not a reason to avoid using them. Feeling you're more clever because you leave them off doesn't make you so. JS interpreters use semicolon insertion: it's not that they're not needed, it's that they're being added for you if you don't use them.

It's not about being clever. As I've said before, it takes all of 10 minutes to understand it, but nobody cares. There is nothing magic about ASI, a line break ends a statement in 99% of the cases.

Re: Bootstrap's maintainer hates the semicolon

#133

Earlier quoted context omitted.

I happen to have a definite, knock-down argument in favour of a particular semi-column free style: mandatory indentation (which also eliminates curly braces). http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-i... I'll grant you that's not a large scale experiment on a peer reviewed paper. But I trust Chris Okasaki on this one, and to me, his experiment counts as strong evidence against semicolons and bracke…

Downvote? What could possibly warrant that? Not that I'm offended, but I am confused. I thought I was accurate and relevant. Did I get some fact wrong? Or did I say something offensive? Re-reading my post, I find 2 potentially offensive excerpts: "Dennis Ritchie didn't know better" Assuming mandatory indentation is superior, this one is flatly true (and there are other things to be said about the syntax of types). Bu…

That's a score for coffeescript, but you don't want to start that discussion here...

Re: Bootstrap's maintainer hates the semicolon

#134

Earlier quoted context omitted.

It's just embracing the ASI. Nothing wrong with it. On the contrary, the understanding necessary to use it implies good knowledge of the language.

> It's just embracing the ASI. As opposed to embracing the rationally derived and broadly accepted coding guidelines used by over 99% of open-sourced javascript projects. I could embrace linguistic documentation and still speak a form of English that would be unnecessarily dense or terse, or just plain incomprehensible to 99% of the English speaking public.

That's been done, and it's comprehensible to 90-95% on the other side. Bad analogy ;)

http://en.wikipedia.org/wiki/Differences_between_Afrikaans_a...

Re: Bootstrap's maintainer hates the semicolon

#135

Earlier quoted context omitted.

I understand JS just fine, and I know where semicolons are needed and where they aren't. But minimalism is not a reason to avoid using them. Feeling you're more clever because you leave them off doesn't make you so. JS interpreters use semicolon insertion: it's not that they're not needed, it's that they're being added for you if you don't use them.

It's not about being clever. As I've said before, it takes all of 10 minutes to understand it, but nobody cares. There is nothing magic about ASI, a line break ends a statement in 99% of the cases.

The question is, why should I care to not end a statement in a semicolon? I gain no advantage. Any speed in coding advantage comes from my editor, not omitting semicolons. Most people commenting here understand ASI. Simply understanding something doesn't make it better. I could write code like I'm a bizarre minifier-human hybrid if I really wanted to. What would that gain me?

Indenting isn't necessary either. Less necessary even than semicolons. We do it for a reason. Maintainability, understandability.

The less ambiguity the better.

The only advantage you get is you can see a thread like this and say I DON'T USE SEMICOLONS CUZ I BE SO SMART I GET JS SO GOOD. But you're not coding to work with other people. It helps no one else, it's esoteric and unnecessary.

Re: Bootstrap's maintainer hates the semicolon

#136

Earlier quoted context omitted.

It's not about being clever. As I've said before, it takes all of 10 minutes to understand it, but nobody cares. There is nothing magic about ASI, a line break ends a statement in 99% of the cases.

The question is, why should I care to not end a statement in a semicolon? I gain no advantage. Any speed in coding advantage comes from my editor, not omitting semicolons. Most people commenting here understand ASI. Simply understanding something doesn't make it better. I could write code like I'm a bizarre minifier-human hybrid if I really wanted to. What would that gain me? Indenting isn't necessary either. Less ne…

I don't see the need for personal offense here. You don't like it, ok, but it's a perfectly reasonable, rational and valid approach. NPM, the node.js package manager with +7000 packages published, is written in ths style.

Re: Bootstrap's maintainer hates the semicolon

#137

Earlier quoted context omitted.

The question is, why should I care to not end a statement in a semicolon? I gain no advantage. Any speed in coding advantage comes from my editor, not omitting semicolons. Most people commenting here understand ASI. Simply understanding something doesn't make it better. I could write code like I'm a bizarre minifier-human hybrid if I really wanted to. What would that gain me? Indenting isn't necessary either. Less ne…

I don't see the need for personal offense here. You don't like it, ok, but it's a perfectly reasonable, rational and valid approach. NPM, the node.js package manager with +7000 packages published, is written in ths style.

I'm not taking personal offense, I'm just saying 1. It's not perfectly reasonable. 2. It's not rational 3. It is valid, but it is not sound. It's not an advantageous approach. It is annoying to other coders.
Post reply on HN