Live data from Hacker News

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

github.com

141–150 of 224 posts

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

#141
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.

The time is ripe for Dart!

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

#142
Why is this discussion about semi-colon insertion and not about the use of short-circuiting as a replacement for specific 'if' statements and general inconsistency in the project?

https://github.com/twitter/bootstrap/blob/master/js/bootstra...

https://github.com/twitter/bootstrap/blob/master/js/bootstra...

(Incidentally, would lines 54/56 of bootstrap-modal suffer from the same problem? Or does the fact that the last function call on line 54 is already in an && expression change things)

I'm kind of surprised that the bug wasn't fixed by changing the line to `isActive || $parent.toggleClass('open')` as is done here https://github.com/twitter/bootstrap/blob/master/js/bootstra...

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

#143

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?

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

in vim pressing A lets me change things at the end of the line, and semicolons get in the way of that

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

#145

Earlier quoted context omitted.

Can you parse this expression without parentheses? a && b && c || d || e + f > g && h The parser sure can. Do you have all the operator precedences memorized, or do you use superfluous parentheses because you're not always sure? It's true that the semicolon is not needed, and it's true that the minifier is breaking code. It may even be true that Crockford should fix it. But that doesn't change the fact that the omit-…

Do you use parenthesis to denote order of operations in all cases, even when extremely obvious? If not, should we assume your position is absurdly immature hipster posturing that serves no engineering purpose?

I use Lisp, so the answer to your question is yes. I do use parenthesis in all cases.

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

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

This is one of the many reasons why I love Go's pragmatism. gofmt is the end of all this kind of silly unproductive arguments.

The sad thing is that apparently some programmers take this stuff so seriously that they refuse to learn a language that wont let them use their pet brace style or whatever. I wonder how they collaborate with other programmers or if they would reject a job offer from a company that used the wrong coding style.

P.S.: Also Go's syntax manages to keep code semicolon-free while avoiding the pitfalls of JavaScript.

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

#147

Earlier quoted context omitted.

Why? This unfortunate behavior is well described by Wadler's Law: http://www.haskell.org/haskellwiki/Wadlers_Law

Few people truly understand the semantics of a language, but everyone knows why indexing from 1 is bad.

... that is, for some values of "everyone" ;)

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

#149
post #115

Earlier quoted context omitted.

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"…

If JSMin is not among their target environments, they should not use it.
Post reply on HN