Tabs vs Spaces
Moderators: phlip, Moderators General, Prelates
Re: Tabs vs Spaces
Is it possible some editors/languages tend to use spaces more, and others tend to use tabs more?
Mighty Jalapeno: "See, Zohar agrees, and he's nice to people."
SecondTalon: "Still better looking than Jesus."
Not how I say my name
SecondTalon: "Still better looking than Jesus."
Not how I say my name
Re: Tabs vs Spaces
The whole survey is obviously rigged. Tabs are superior for indentation because you're free to set your own tab size locally and the best-paid coders know this.
Re: Tabs vs Spaces
The best-paid coders also know when to trade off theoretical purity for practicality. They understand that while tabs to indent and spaces to align is the ideal, it's also easy to screw up, and that when you do, you wind up with a hot mess that's just awful; and "spaces only", while not as good in the best case, are both a lot harder to screw up and easier to enforce.Flumble wrote:Tabs are superior for indentation because you're free to set your own tab size locally and the best-paid coders know this.

- flicky1991
- Like in Cinderella?
- Posts: 706
- Joined: Fri Feb 11, 2011 3:36 pm UTC
- Location: London
Re: Tabs vs Spaces
Flumble wrote:The whole survey is obviously rigged. Tabs are superior for indentation because you're free to set your own tab size locally and the best-paid coders know this.
That's exactly what makes tabs worse - what lines up to one person may be out of alignment to another because their tab size differs.
avatar from marionic
----
any pronouns
----
Forum Games Discord
(tell me if link doesn't work)
----
any pronouns
----
Forum Games Discord
(tell me if link doesn't work)
- Xenomortis
- Not actually a special flower.
- Posts: 1410
- Joined: Thu Oct 11, 2012 8:47 am UTC
Re: Tabs vs Spaces
Why are you aligning with tabs?
Don't align with tabs - bad things will happen when you align with tabs.
I heard that it was people aligning with tabs that drove some employees to madness and despair, causing them to release the dinosaurs and ultimately end all operations.
Don't align with tabs - bad things will happen when you align with tabs.
I heard that it was people aligning with tabs that drove some employees to madness and despair, causing them to release the dinosaurs and ultimately end all operations.

Re: Tabs vs Spaces
As always with these religious wars the answer is obvious. The 'best' way to do these kinds of things is to tab for indentation and if you must align use spaces. That way even if the tab width changes things are still aligned.
But people are a bunch of bastards so the 'best' practice is just to make sure there is a consistent approach in the codebase and give a good public flogging to anybody that deviates.
But people are a bunch of bastards so the 'best' practice is just to make sure there is a consistent approach in the codebase and give a good public flogging to anybody that deviates.
double epsilon = -.0000001;
Re: Tabs vs Spaces
That way even if the tab width changes things are still aligned.
Assuming you only align across the same level of indentation. Use tabs for spaces, spaces for indentation, a tabstop of one, and fuck everyone else.
Behold your only true messiah. An entity of which you're a part.
A vast and cold indifferent being. A grey clad mass without a heart.
A vast and cold indifferent being. A grey clad mass without a heart.
Re: Tabs vs Spaces
Wouldn't it be awsome if the (text) file used to hold the document had embedded within it the tab setting? Or is that heresy, de-purifying text and moving too close to word processing?
Jose
Jose
Order of the Sillies, Honoris Causam - bestowed by charlie_grumbles on NP 859 * OTTscar winner: Wordsmith - bestowed by yappobiscuts and the OTT on NP 1832 * Ecclesiastical Calendar of the Order of the Holy Contradiction * Please help addams if you can. She needs all of us.
Re: Tabs vs Spaces
ucim wrote:Wouldn't it be awsome if the (text) file used to hold the document had embedded within it the tab setting? Or is that heresy, de-purifying text and moving too close to word processing?
So first, some editors can do this already. Emacs and Vim both support "mode lines" in your file, which you can use to set editor variables. For emacs, you'd put -*- tab-width: 5 -*- to set your tab width at five characters. (That could go into a comment for your language of choice.)
However, to me this seems... not very useful? The main benefit of tabs is that you can choose the tab stop that meets your preference for indent width (if the indentation and alignment are properly written). Fixing the tab width negates that benefit.
Re: Tabs vs Spaces
I know. I was aiming for a bit of ferric inclination.EvanED wrote:So first, some editors can do this already.
It would make it easy to consistencize tab widths between files, or convert tabs to spaces (and v.v.).EvanED wrote:However, to me this seems... not very useful?
A file that is indented with spaces is difficult to re-indent; tabs do this automatically. It would be nice if spaces and tabs looked (unobtrusively) different though.
Jose
Order of the Sillies, Honoris Causam - bestowed by charlie_grumbles on NP 859 * OTTscar winner: Wordsmith - bestowed by yappobiscuts and the OTT on NP 1832 * Ecclesiastical Calendar of the Order of the Holy Contradiction * Please help addams if you can. She needs all of us.
Who is online
Users browsing this forum: No registered users and 3 guests