Hacker News new | past | comments | ask | show | jobs | submit login

Doesn't HTTP compression make minification largely unnecessary?

It depends. If you have really high traffic or you care about every last microsecond of responsiveness, minification is essential. Also, minifiers these days tend to know about scope and program structure and may even be able to figure out when you're referring to defined browser objects like 'window'. So you just get that much more bang for the buck when combined with other forms of compression.

As for your other question, about convention: back in the dark days of the mid-90s Javascript was just the subset of scripts that both IE and Netscape would support. Omitting semicolons usually caused horrible bugs in one or the other. Also, most tools for formatting source code assume that newlines are not significant, and may wrap, split, or join lines in a way that breaks the logic.

Anyway, most battles over source code standards end in the most explicit option winning. This case is no exception.

Your question is fair, considering that ECMAscript is standardized now. In principle, you could switch to a newline-terminated style, thus saving a whole extra character per line. (But that would be eliminated if you minified).

However, even today, I would guess that omitting semicolons risks breakage. Browser makers don't test much with newline-terminated scripts.




Thanks for the considered response: this sort of background information is exactly what I was looking for.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: