News for hackers. Stuff that matters.
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by drivebyacct2 on Sunday April 15, 2012 @12:28AM (#3842753)
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?

Re:Crockford on Bootstrap's semicolon omission: “insanely st... by YuriNiyazov on Sunday April 15, 2012 @12:29AM (#3842760)
Is there any particular reason why you refuse to put in the semicolons in Javascript?
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by jpeterson on Sunday April 15, 2012 @12:33AM (#3842770)
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.

Re:Crockford on Bootstrap's semicolon omission: “insanely st... by bratsche on Sunday April 15, 2012 @12:57AM (#3842831)
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.

Re:Crockford on Bootstrap's semicolon omission: “insanely st... by Osiris on Sunday April 15, 2012 @02:31AM (#3843000)
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.
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by chime on Sunday April 15, 2012 @02:16AM (#3842969)
> I believe CoffeeScript is the culprit.

CoffeeScript removes semicolons from CoffeeScript, not JavaScript.

Re:Crockford on Bootstrap's semicolon omission: “insanely st... by leetrout on Sunday April 15, 2012 @12:42AM (#3842794)
Meh, the real hipsters are just pushing comma-first.
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by maratd on Sunday April 15, 2012 @01:25AM (#3842892)
They're all hipsters.
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by sjwright on Sunday April 15, 2012 @01:54AM (#3842934)
Hey everyone, I've just learned to drive without wearing a seatbelt. It's possible! The laws of physics allow it!
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by prodigal_erik on Sunday April 15, 2012 @04:34PM (#3844651)
Driving without a seatbelt would be perfectly reasonable if I had a written list of all possible accidents to drive around. The twist here is that the one and only grammar change that could break this code may actually happen soon. Until then, though, the code is valid and Crockford is intentionally leaving a bug in jsmin.
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by groovy2shoes on Sunday April 15, 2012 @12:36AM (#3842782)
Because standard-compliant JavaScript implementations don't require them (ECMAScript describes a model of "semicolon insertion" that implementors are supposed to follow).
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by underwater on Sunday April 15, 2012 @01:18AM (#3842873)
Not required doesn't necessarily mean it's a good idea.

If they were never needed I'd understand, but sometimes they are. I don't see the point in forcing the developer to make a conscious decision on whether to include a semicolon.

Omitting semicolons also means that the correctness of a line of code is determined by the unrelated lines that follow.

Re:Crockford on Bootstrap's semicolon omission: “insanely st... by groovy2shoes on Sunday April 15, 2012 @01:29AM (#3842897)
While the virtues of semicolon insertion are highly debatable, developers are permitted by the ECMAScript standard to write code that relies on it. A tool like JSMin should be aware of semicolon insertion. ricardobeat put it very well elsewhere in this thread: "It is a bug on JSMin. Minifying should never alter code behaviour."
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by ars on Sunday April 15, 2012 @02:55PM (#3844341)
Actually JSMin is aware of semicolon insertion and handles it correctly.

They just disagree on whether a semicolon gets inserted here.

Re:Crockford on Bootstrap's semicolon omission: “insanely st... by groovy2shoes on Sunday April 15, 2012 @03:47PM (#3844503)
Unfortunately for JSMin, browsers attempt to implement at least the ECMAScript specification, not just "the good parts."
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by ricardobeat on Sunday April 15, 2012 @12:47AM (#3842804)
Re:Crockford on Bootstrap's semicolon omission: “insanely st... by hhhhhhhhh on Sunday April 15, 2012 @05:47AM (#3843270)
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 st... by drivebyacct2 on Sunday April 15, 2012 @01:29AM (#3842899)
Like I said, there are many, many libraries that don't use them.

I used to prefer having semicolons in my javascript, then I started writing a bunch of Go. Now I wind up forgetting sometimes, though some part of me likes it, and so I continue using semicolons in my javascript.

That having been said, I think it's a matter of personal opinion (likely just what a given person is used to), and if it fits with the spec and the common usage, then you'd think a library that is expected to work with/on other libraries would try to be accommodating.

edit: To further clarify, Javascript's stance is silly, because you need to know how semicolon insertion works. It's extra knowledge you have to have. Thus, I think I agree with most here that it's easier to just use them. (Other languages have optional semicolons but they don't change the meaning of the syntax at all.)

edit2: This is GitHub, why is there not a fork already with this issue behind us?

Re:Crockford on Bootstrap's semicolon omission: “insanely st... by ricardobeat on Sunday April 15, 2012 @02:15AM (#3842968)
uglifyjs and closure compiler seem to be totally safe.