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

If it can tell you forgot the semicolon it probably can do without it, so why doesn’t it? ;)



Ambiguity. 95% of the cases you forgot the semicolon, the other 5% you forgot something else.


g++ (and I assume other compilers) may diagnose it as missing either a comma (because of the comma operator) or a missing semicolon (can't find the end of statement) - silently providing one or the other would not be a good idea.

Actually, I remember Jerry Pournelle asking exactly the same question about Pascal in Byte magazine in the 1980s.


JavaScript has automatic semicolon insertion and I'm not a fan


Ah, but are you not a fan because of the automatic semicolon insertion or because... well, JavaScript :P


Because it's a massive headache to debug code that has subtle bugs due to missing semi-colons.


Never happened to me TBH. There's very few cases where the semicolon is actually significant, and when it happens my autoformatter produces garbage which makes it very obvious, or it adds the semicolon itself.

That doesn't mean it never happens (most of us inherited a shitty codebase lacking things like code standards and autoformatting at some point), but I always find it strange that people keep talking about this thing I've never experienced in years writing JS professionally




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: