Tabs vs Spaces

Please compose all posts in Emacs.

Moderators: phlip, Moderators General, Prelates

User avatar
Zohar
COMMANDER PORN
Posts: 7560
Joined: Fri Apr 27, 2007 8:45 pm UTC
Location: Denver

Re: Tabs vs Spaces

Postby Zohar » Tue Jun 20, 2017 12:53 pm UTC

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

User avatar
Flumble
Yes Man
Posts: 1951
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: Tabs vs Spaces

Postby Flumble » Tue Jun 20, 2017 5:15 pm UTC

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.

EvanED
Posts: 4327
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Tabs vs Spaces

Postby EvanED » Tue Jun 20, 2017 8:12 pm UTC

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.
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. ;-)

User avatar
flicky1991
Like in Cinderella?
Posts: 632
Joined: Fri Feb 11, 2011 3:36 pm UTC
Location: London

Re: Tabs vs Spaces

Postby flicky1991 » Tue Jun 20, 2017 8:45 pm UTC

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.
any pronouns (mainly she/he)
----
Avatar from ArguablyDerek
----
Discord for Forum Games posters
(Please let me know if the link doesn't work)
Spoiler:
Weeks wrote:
flicky1991 wrote:Maybe I am a female Justin Bieber!
Justine Bieber. Alternatively, Miley Cyrus.

User avatar
Xenomortis
Not actually a special flower.
Posts: 1397
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Tabs vs Spaces

Postby Xenomortis » Tue Jun 20, 2017 9:23 pm UTC

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.
Image

User avatar
Dason
Posts: 1309
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: Tabs vs Spaces

Postby Dason » Fri Jun 23, 2017 2:32 pm UTC

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.
double epsilon = -.0000001;

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 5513
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Tabs vs Spaces

Postby Thesh » Fri Jun 23, 2017 5:37 pm UTC

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.
Honesty replaced by greed, they gave us the reason to fight and bleed
They try to torch our faith and hope, spit at our presence and detest our goals

User avatar
ucim
Posts: 5634
Joined: Fri Sep 28, 2012 3:23 pm UTC
Location: The One True Thread

Re: Tabs vs Spaces

Postby ucim » Sat Jun 24, 2017 3:05 am UTC

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
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.

EvanED
Posts: 4327
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Tabs vs Spaces

Postby EvanED » Sat Jun 24, 2017 7:29 am UTC

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.

User avatar
ucim
Posts: 5634
Joined: Fri Sep 28, 2012 3:23 pm UTC
Location: The One True Thread

Re: Tabs vs Spaces

Postby ucim » Sat Jun 24, 2017 5:24 pm UTC

EvanED wrote:So first, some editors can do this already.
I know. I was aiming for a bit of ferric inclination.

EvanED wrote:However, to me this seems... not very useful?
It would make it easy to consistencize tab widths between files, or convert tabs to spaces (and v.v.).

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.


Return to “Religious Wars”

Who is online

Users browsing this forum: No registered users and 5 guests