DEV Community

Discussion on: Who Killed The Tab?

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

What if 80% of devs would jump from a bridge?

Also:

source code should ONLY contain printable ASCII characters

  1. There's no functional difference between tabs and spaces. They're both just some blank space.
  2. You've already allowed for one exception, so why newlines but not tabs?
  3. This doesn't make sense either way. People argue that "nobody presses space bar to indent" but insist on using only printable characters? What's the rationale for that inconsistency?
Collapse
 
leob profile image
leob • Edited

Doesn't make sense to me at all, except for the 80%, which I agree is not a strong argument.

I said there's ONE exception (newlines), so that's the one and only exception, simple.

The fundamental difference between a space and a tab is that with a space always occupies the width of one "space" - so I can right away see that they're spaces, and how many there are - assuming that we don't use tabs. But if you allows tabs then that breaks down, it violates the "WYSIWYG" principle.

Well I guess you can still argue about it, but if I'm leading the project then tabs won't enter my codebase :-)

Thread Thread
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

I said there's ONE exception (newlines), so that's the one and only exception, simple.

Yes, that's my point: one is an arbitrary number.

But either way, what's the point of that rule in the first place? In what case will you run into problems because your source code contains "non printable" tab characters?

To me it seems like this is just a personal preference, which makes as much sense as writing code that rhymes. If you want to do it, sure, but why should the whole world adopt this minor aesthetic preference?

As for the WYSIWYG principle, that just doesn't make any sense. First of all, most modern editors can visualize tabs and spaces, so the practical difference is just not there. The only difference is that, if I decide to use an indentatino of 8, you will also be stuck with it when editing the same code (or, more realistically, I might be stuck with a tab width of 2 which I find uncomfortably small so I will be less likely to work in that codebase). Or should I be expected to re-indent every file before and after working on it?

Thread Thread
 
bytebodger profile image
Adam Nathaniel Davis

To me it seems like this is just a personal preference, which makes as much sense as writing code that rhymes. If you want to do it, sure, but why should the whole world adopt this minor aesthetic preference?

Bingo! I don't personally mind someone arguing for spaces (or vice versa). But I'll admit that I do get annoyed whenever someone tries to argue for their preference by trying to twist it into some kinda empirical argument. I mean, if you really really like cinnamon, then throw it into all your dishes. You can even try to convince me to use it in all my dishes as well. But don't try to disguise your preference under some kinda faux-logical argument.

The only difference is that, if I decide to use an indentatino of 8, you will also be stuck with it when editing the same code (or, more realistically, I might be stuck with a tab width of 2 which I find uncomfortably small so I will be less likely to work in that codebase). Or should I be expected to re-indent every file before and after working on it?

The key here is that those arguing for 2-space indentation don't really have empirical reasons for it. The simple fact is that they like 2-space indentation. Which is fine. I don't have any problem with that. Just acknowledge it for what it is.

Every argument that you can make in favor of 2-space indentation could also be made for 8-space indentation. But most "space fanboys" would think an 8-space standard is ridiculous. In fact, the more I think about it, the more I'm convinced that the only way to logically discuss space-based indentation is to say, "Cool. Let's set EIGHT spaces as the standard." And then observe the appalled and disgusted looks on the faces of those who were arguing for 2-space indentation.

Of course, if you were using tabs, there is no argument to be had. Because every individual dev can set their own default for tab width. So if I started arguing for 8-space tabs, the logical reply would be, "Sure, set them however you like in your IDE."

But when you use spaces instead of tabs, you're deciding, for everyone else, exactly how they need to view the code. And those who argue for 2-space indents don't care - because they like 2-space indents. But if you turned it around on them and said, "No. I think we should use EIGHT-space indents." They'd think that's patently absurd.

Thread Thread
 
leob profile image
leob • Edited

Well now you're talking, that's the only argument until now that makes sense - by choosing tabs for indentation you can choose how it looks visually i.e. how wide the indentation is, with spaces that's fixed and you don't have that flexibility. So yes, if you use tabs consistently and only for indentation then there's something to be said for it.

Thread Thread
 
bytebodger profile image
Adam Nathaniel Davis

I have signed you up for a confidential membership in Tab-Lovers Anonymous.

Don't worry. I won't tell your friends. 😁

Thread Thread
 
leob profile image
leob

Thanks, well I hope they don't read this then!