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

Being a programmer won't save you from this particular style war. If there's a comment in your code with a sentence that begins with a double space, your code formatter probably won't flag or remove it in the same way that MS Word will. And it's likely shown in a monospace font, which makes it more noticeable.

How many spaces do people put after a full stop in comments in their code?

I go with one, but Vim's J and gq commands annoyingly insert two spaces when joining sentences from separate lines. I'd love it if someone could tell me how to fix this.

Edit: found it, the command is "set nojoinspaces"



Broadly speaking, internal consistency is the best & most important style. So just follow the convention of the codebase you are working in (ideally with a code formatter to help)


I go for two, but that's only because it is now in my muscle memory to apply two spaces after a full stop. This came about when I was doing a typing certificate in the UK in the late 90s and I've continued to do it ever since.


It is even more amusing in Java. Many folks essentially try to do markdown, not realizing that they are probably writing one giant paragraph.




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

Search: