Hacker News new | ask | show | jobs
by Jemaclus 3830 days ago
Tabs for indentation, hands down. Every editor out there worth its salt can adjust the tab size the way you want. If you want 1 tab = 2 spaces, you can do that. If I want 1 tab = 4 spaces, I can do that. Either way, it's one tab, and we're all happy. It's literally a win/win scenario. I have never understood the argument for spaces for indentation, not when tabs are at our disposal.
3 comments

> Every editor out there worth its salt can adjust the tab size the way you want

this is the one strong argument for tabs that i have heard, over and again. it makes a lot of sense.

if this was a real issue i'd fall that side of the argument, since its not i go with the consensus and /prefer/ 4 spaces.

in reality though i end up mixing 4 spaces with tabs based on default editor configurations and i what i end up working with.

it doesn't cause real world problems.

2 spaces is nice if you work in exceptionally backwards command line environments and have no tab character input mechanism (this is not uncommon, although it /is/ stupid imo).

... now a long time ago i did switch from tabs to spaces, the reason was simple, google code and other web based code viewers would use the standard 5 spaces for a tab, so mixed and matched tabs and spaces looked ugly and ascii art in comments would get broken.

i'm not sure thats a real issue any more...

You just described spaces for indentation.

A tab is a special ascii character, which most IDE's replace with spaces if you want to (like you described).

I believe you are misunderstanding what they're saying. they are saying you use the special characters and your editor can display it as you please (2char wide or 4char wide). if you literally replace the tab char with N spaces, my editor will now show it as N spaces.
Spaces for the beauty of code

    foo : ( bar )
        | i just want to align this
        | when writing syntax definitions
That's alignment, not indentation. There's a semantic difference there.