this post was submitted on 28 Feb 2024
616 points (97.2% liked)

Programmer Humor

19735 readers
785 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

founded 1 year ago
MODERATORS
616
wait what (pawb.social)
submitted 9 months ago* (last edited 9 months ago) by [email protected] to c/[email protected]
 
you are viewing a single comment's thread
view the rest of the comments
[–] fluckx 2 points 9 months ago* (last edited 9 months ago) (1 children)

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.

var user_name = "Bob"
var user_age[tab]= "Bob"

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

[–] [email protected] 4 points 9 months ago (1 children)

The way you explain it sounds like how tabs works in MS Word ( or other word processors ).

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.

[–] fluckx 2 points 9 months ago

Generally I'm not very preoccupied with it as the IDE just formats it the way I like it on save :D.