Hacker News new | ask | show | jobs
by phaedryx 4862 days ago
Because of semicolon insertion, Allman-style braces are frowned upon. https://www.google.com/search?q=javascript+brace+style
2 comments

I would just like to point out that people tend to blow the semicolon insertion thing out of proportion. For braces it really only comes up when returning object literals and for other things there are just a couple of features that can bite you (starting lines with parenthesis or array literals and so on)

http://inimino.org/~inimino/blog/javascript_semicolons

Sure, its best to always explicitly use semicolons but its not as dangerous to forget them as most make it sound.

While semicolon insertion itself does cause many problems, the mere fact that it exists as a "feature" of the language is perhaps a bigger problem.

There's no justifiable reason for it to exist. The drawbacks should have been clear from the moment the concept arose, and it should have been scrapped before ever having been implemented. That's the only sensible response to it, after even a minimal amount of analysis.

A missing semicolon should be treated as an error, causing the execution of the script to be immediately halted, and the programmer notified of it. It is as simple as that.

Other way around - because of braces and many other issues brought up when you try to take advantage of Automatic Semicolon Insertion, that is frowned upon.