Hacker News new | ask | show | jobs
by lcnPylGDnU4H9OF 583 days ago
Since we’re already on a Holy War About Arbitrary Things topic (and at the risk of igniting the whitespace wars anew), do you mind expanding on this?

> I hate tabs

This opinion seems common but I haven’t seen a practical argument against tabs among practical arguments (for an admittedly niche situation) in favor of tabs. This seems an appropriate place to ask about it.

3 comments

I wouldn't say, I hate tabs. But I strongly prefer not using tabs in source code. Let me explain why. There are some languages and coding styles where it doesn't really matter. E.g. when you are always indenting by multiples of some indentation length. But there also languages and coding styles where you want to align stuff.

Consider this example:

    def someFunctionName(Int firstParameter, Boolean secondParameter, String thirdParameter)
Let's say, that line is too long. We could format it like this:

    def someFunctionName(Int firstParameter, Boolean secondParameter, 
        String thirdParameter)
    
Or we could format it like this:

    def someFunctionName(Int firstParameter, Boolean secondParameter, 
                         String thirdParameter)
Or event his

    def someFunctionName(Int firstParameter, 
                         Boolean secondParameter, 
                         String thirdParameter)
In the second two variant the indentation depends on the length of someFunctionName, so it is not necessarily a multiple of four or whatever your tab width is.

There are other similar situation when aligning in multiple columns, etc.

I simply find spaces easier to navigate. I don't always use vim-golf-winning movements, and when I am being lazy using hl or arrow keys, I expect to move a space at a time. Tabs violate that expectation.

It's a visceral rather than a rational thing (which I suppose is implied by the word "hate" :->). I also have trailing spaces and all tabs highlighted for similar reasons.

tabs are not great in Python because they can hide spaces, and that causes the code to break. in other code? i guess tabs are nicer because people can size them as they like on their devices.
I use tabs in python and it works fine, I just enable "show whitespace" in my editor.
> i guess tabs are nicer because people can size them as they like on their devices

This is the only case that has me thinking that tabs are an actual solution to a relatively uncommon problem.

I recall an anecdote about someone’s colleague whose eyesight was going bad, which required them to use a huge font size to the point that the width of the screen could fit just one or two words. Two spaces is less convenient than one tab when the text editor can be configured to render the tab as a one-character-width space.

(That’s the “admittedly niche situation” I mentioned initially. I call it “niche” but I’d still hope most teams would be accommodating for such a situation.)