Live data from Hacker News

Bootstrap's maintainer hates the semicolon

github.com

91–100 of 137 posts

Re: Bootstrap's maintainer hates the semicolon

#91
post #33

Earlier quoted context omitted.

alternatively, use JSLint

I much prefer JSHint. JSLint is draconian, and has some borderline insane decisions (it complains if you don't declare your vars at the top of a block—is this 1980?). And yes, I realise that some of these options can be turned off —but JSHint has better defaults.

jshint is great. Putting this in ~/.jshintrc makes it a lot more sane:

    {
      "browser" : true,
      "node"    : true,
      "undef"   : true,
      "eqeqeq"  : true,
      "noarg"   : true
    }

Re: Bootstrap's maintainer hates the semicolon

#92
post #83

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.

And is therefore more expensive to maintain.

It's probably less expensive to maintain, because programmers' brain reading the code while not having to parse the extra image information - which semicolons are, and they add a lot of clutter - gets less tired and in turn is less prone to make errors in other coding areas.

I see two camps here - people who fear the unknown or come from semicolon-mandatory languages and can't get used to the semicolon-less style, and informed people who don't fear to embrace what is aesthetically more pleasing and logically more sound, despite the persecution by the members of the first camp, which I'd say also happens to be more religion-prone.

Re: Bootstrap's maintainer hates the semicolon

#93
post #90
post #89

Earlier quoted context omitted.

So now you've gone from a semicolon, which has the sole purpose of separating statements; to a bang, which doesn't make any sense in this context unless you know that it's replacing a semicolon. Better or worse?

You could use anything which separates statements or ensures the function is treated as an expression. Two examples which are more in keeping with the intended use of the operators in question: ;function() { // Some initialization. }() void function() { // Some initialization. }()

So now we've gone a) from semicolon consistently after statements, to having to remember where to prefix with semicolons, or b) from one character to four.

Why aren't we just using the semicolon as it is required in any other (C-based) language?

Re: Bootstrap's maintainer hates the semicolon

#94

Earlier quoted context omitted.

Leaving semi-colons out is not clever, it's just understanding where you need them instead of shooting blindly.

Does it hurt to have extra semi-colons? Maybe you have some empty statements. Does it hurt to have too few? Well, if you either do not know what you're doing, or someone maintaining doesn't understand what you did, etc., then yes.

Extra semicolons can cause problems. If "someone who doesn't know what they're doing" starts putting semicolons after randomly chosen tokens, it will absolutely break your program. You need to understand statement boundaries whether or not you explicitly mark them with semicolons.

Re: Bootstrap's maintainer hates the semicolon

#95

I wouldn't see any significant problem with a policy of omitting semi-colons when there's no risk of ambiguity, but turning the omission of semi-colons into a religion? That's enough to make me question what other nutty peculiarities exist in his coding philosophy, and therefore whether I'd dare risk my own projects using his library.

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.

The point of programming is not to show off how well you know the language, else we'd be writing our C in trigrams and our JS in []()+!:

http://discogscounter.getfreehosting.co.uk/js-noalnum.php

Re: Bootstrap's maintainer hates the semicolon

#96
post #92
post #83

Earlier quoted context omitted.

And is therefore more expensive to maintain.

It's probably less expensive to maintain, because programmers' brain reading the code while not having to parse the extra image information - which semicolons are, and they add a lot of clutter - gets less tired and in turn is less prone to make errors in other coding areas. I see two camps here - people who fear the unknown or come from semicolon-mandatory languages and can't get used to the semicolon-less style, an…

I try to assume good faith with HN comments, but this smells like a troll.

In JavaScript, semicolons reduce ambiguity. Whether you know the semicolon rules in the language or not is immaterial to reducing ambiguity, similar to how defensive parenthesization is helpful regardless of whether you know the order of operations of a given language by heart. This is why the prevailing wisdom is to always use semicolons: principle of least surprise.

The nonsense about "persecution" and "more religion-prone" is just that. "Informed people" -- "aesthetically more pleasing" -- "logically more sound" -- ad hominem and begging-the-question horseshit. Do better.

Re: Bootstrap's maintainer hates the semicolon

#97
Is this really about semicolons, or is it just that with so many fucking people watching, using, and messing around with the bootstrap repo that you're bound to find a bunch of bizarre little edge-case problems? You know what I mean?

My repos don't have a lot of semicolon-related problems, because they don't have almost 20,000 watchers and tons of people using my code.

Re: Bootstrap's maintainer hates the semicolon

#98
post #6

I don't get what the issue is. I run bootstrap js through the closure compiler (with minification and optimization) and it works just fine. I don't agree with the policy myself, I prefer semicolon, but I also prefer CoffeeScript. That said, if Fat wants to remove it, that is his choice, leave him alone. Update: Just read his blog posting. If Fat really wanted the minimalist approach, he'd use coffeescript and then pe…

Did you just say using CS is minimalist?

I believe he was referring to terse code.

Re: Bootstrap's maintainer hates the semicolon

#99
post #92
post #83

Earlier quoted context omitted.

And is therefore more expensive to maintain.

It's probably less expensive to maintain, because programmers' brain reading the code while not having to parse the extra image information - which semicolons are, and they add a lot of clutter - gets less tired and in turn is less prone to make errors in other coding areas. I see two camps here - people who fear the unknown or come from semicolon-mandatory languages and can't get used to the semicolon-less style, an…

You don't think there's a third camp of people who know all about ASI but choose not to use it because their cognitive capacity (and that of their teammates, who may not spend weekends reading the ECMAScript spec) is better spent elsewhere?

Re: Bootstrap's maintainer hates the semicolon

#100
post #92
post #83

Earlier quoted context omitted.

And is therefore more expensive to maintain.

It's probably less expensive to maintain, because programmers' brain reading the code while not having to parse the extra image information - which semicolons are, and they add a lot of clutter - gets less tired and in turn is less prone to make errors in other coding areas. I see two camps here - people who fear the unknown or come from semicolon-mandatory languages and can't get used to the semicolon-less style, an…

[deleted]
Post reply on HN