this post was submitted on 28 Feb 2024
637 points (97.2% liked)
Programmer Humor
19670 readers
210 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Correct. The way I'm used to it ( and how I thought the world worked ) is that the IDE gives tab a fixed length or characters. If you set it to 4 it would be the equivalent of 4 spaces or 4 letters or whatever.
If my tab is set to 4 it would take up the width of 4 characters. If I need two indentations I would press tab twice.
If bob then checks out my code and calls me a maniac and sociopath for using indentation and swears by "2", the code would just look more condensed. The alignment would still work out because that's done through spaces.
This would align the
=
for Bob, because it needs two characters to align and that's what his tab width is. It wouldn't align for me because my tab width is 4. So I would.pur two spaces instead of the . That way it is aligned for everybody regardless of their tab width settings.The way you explain it sounds like how tabs works in MS Word ( or other word processors ).
I don't think I could work like that. I've only ever used IDEs to code ( regardless of how primitive they were back when I started). Interesting take though :D
That is exactly how they work, and after 40 years, I still struggle with the whole "tab as a shortcut for spaces" thing. It's not that I started with word processors, either, just that as soon I started working with them, everything got so much easier for me.
There are some code-specific things that keep me from just going back to a word processor, but I think our code editors are missing some useful features that are found in word processors.
Generally I'm not very preoccupied with it as the IDE just formats it the way I like it on save :D.