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

I'm glad I've found at least one kindred spirit in this regard! I was beginning to think I was the only one.

People with a background in non-brace-and-semicolon languages are more likely to feel the same way. Others (e.g. recent graduates learning only Java) may be less comfortable with the lack of semicolons, and may regard it as "sloppy," perhaps from a lack of familiarity, or because they've never thought about it or haven't read the specs and are simply regurgitating what they've heard.

On a related note, in CSS the semicolon is a separator, not a terminator, so to pick on some CSS from an arbitrary Web page:

    body  { font-family:Verdana; font-size:10pt; color:#828282; } /* unnecessary semicolon */
    body  { font-family:Verdana; font-size:10pt; color:#828282 } /* equivalent but shorter */
Also on the topic of cargo-cult coding cruft, you'll often see pseudo-XHTML with self-closing tags that include a space, e.g. "<br />", invariably served as text/html, where it is equivalent to "<br>" with the addition of two extraneous characters and one syntax error. People still actively recommend this practice, despite the fact that even when served as HTML, the extra space has not been necessary since the days of Netscape Navigator 3 or 4.

Perhaps with very, very large and complex code if the JavaScript engine uses an old-style interpreter?

JavaScript is only parsed once, even in ancient browsers, and no matter how much code there is, the time required to download it, not to mention executing it, will typically be orders of magnitude greater than the time spent parsing it. I had never heard the performance reason before as a justification for this practice, but I consider it a total red herring until someone provides hard numbers that suggest otherwise.

Ultimately this is a question of style and personal preference, but if you happen to prefer the cleaner style as I do, I see no technical reasons why you should not use it.

Finally, never forget Wadler's Law:

http://www.haskell.org/haskellwiki/Wadlers_Law




Thanks for the detailed reply.

People with a background in non-brace-and-semicolon languages are more likely to feel the same way.

Yes, and most of them are off happily working with their Pythons, Rubys, Haskells and the like, staying well away from this sort of discussion. :^) I've been writing a lot of ActionScript lately (making games which target Flash), so I've been thinking about ECMAScript-style syntax a lot more than I have in the past.

Also on the topic of cargo-cult coding cruft...

I see "cargo-cult coding cruft" most often in languages which are parsed by a client (e.g. CSS, XHTML, JavaScript). I suspect that this is due to fear that some client, somewhere will choke on the actually-correct code. And whaddaya know - sometimes that client actually exists. It's called Internet Explorer 6. ;^)

Finally, never forget Wadler's Law

Yeah, I'm reminded of an old Python joke:

  Question: Why is Python such a productive language?
  Answer: You won't have to spend any time arguing about brace style.




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

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

Search: