Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks for the kind words. I've been writing javascript like this for more than a year without any trouble. It's not confusing at all, you just need to sit for 5 minutes and understand ASI.

I'd bet with confidence that 90% of programmers out there don't know if a semicolon is needed after a function declaration. They just put it in there blindly, then some day they find a bug because they "forgot" a semi-colon somewhere.



I understand JS just fine, and I know where semicolons are needed and where they aren't. But minimalism is not a reason to avoid using them. Feeling you're more clever because you leave them off doesn't make you so. JS interpreters use semicolon insertion: it's not that they're not needed, it's that they're being added for you if you don't use them.


It's not about being clever. As I've said before, it takes all of 10 minutes to understand it, but nobody cares. There is nothing magic about ASI, a line break ends a statement in 99% of the cases.


The question is, why should I care to not end a statement in a semicolon? I gain no advantage. Any speed in coding advantage comes from my editor, not omitting semicolons. Most people commenting here understand ASI. Simply understanding something doesn't make it better. I could write code like I'm a bizarre minifier-human hybrid if I really wanted to. What would that gain me?

Indenting isn't necessary either. Less necessary even than semicolons. We do it for a reason. Maintainability, understandability.

The less ambiguity the better.

The only advantage you get is you can see a thread like this and say I DON'T USE SEMICOLONS CUZ I BE SO SMART I GET JS SO GOOD. But you're not coding to work with other people. It helps no one else, it's esoteric and unnecessary.


I don't see the need for personal offense here. You don't like it, ok, but it's a perfectly reasonable, rational and valid approach. NPM, the node.js package manager with +7000 packages published, is written in ths style.


I'm not taking personal offense, I'm just saying 1. It's not perfectly reasonable. 2. It's not rational 3. It is valid, but it is not sound. It's not an advantageous approach. It is annoying to other coders.




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

Search: