this post was submitted on 28 Feb 2024
636 points (97.2% liked)
Programmer Humor
19511 readers
397 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
I know it’s a joke but I prefer the tab option. It’s easy to convert tabs to any particular spacing or code point width. It can also vary, if wanted, based on terminal or editor type.
People with worse eyesight can have a wider indentation while those who choose can opt for something more compact
I can't imagine it would be difficult for an IDE to scale the width of spaces found at the start of a line, to emulate this same customization while still preserving my sanity as a fervent space-indenter. I've never seen an IDE that does this, but it'd be an interesting compromise.
It's not difficult at all, and many editors and IDEs already support this, making the entire point moot. Just do whatever the style guide says. I'm into PHP and Python so for me it's spaces all the way.
How can it tell the difference between spaces used for indentation and spaces used for alignment, if you use the same character for both?
All parsers ignore a shitload of whitespace already. Just compare unformatted code, COMPLETELY unformatted code, code without character returns, and it'll become obvious how any given language is interpreted around whitespace.
Also fun to see just how infrequent a semicolon is 'actually' needed to tell when the end of a statement is here.
Maybe alignment more for the righthand side of assignments. If you have a block of variables with different name lengths, or within a constructor / function call.
I guess the indention sizer thing knows how the formater works and adjusts accordingly. I can't imagine it would be too much of a problem.
Iirc Jetbrain IDEs has a feature called dynamic tabs/space (or something like that) which uses exclusively tabs until it needs to align something and a tab doesn't fit, so it uses a few spaces instead.