Page 6 of 6

Re: Tabs vs Spaces

Posted: Tue Jun 20, 2017 12:53 pm UTC
by Zohar
Is it possible some editors/languages tend to use spaces more, and others tend to use tabs more?

Re: Tabs vs Spaces

Posted: Tue Jun 20, 2017 5:15 pm UTC
by Flumble
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

Posted: Tue Jun 20, 2017 8:12 pm UTC
by EvanED
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. ;-)

Re: Tabs vs Spaces

Posted: Tue Jun 20, 2017 8:45 pm UTC
by flicky1991
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.

Re: Tabs vs Spaces

Posted: Tue Jun 20, 2017 9:23 pm UTC
by Xenomortis
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.

Re: Tabs vs Spaces

Posted: Fri Jun 23, 2017 2:32 pm UTC
by Dason
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.

Re: Tabs vs Spaces

Posted: Fri Jun 23, 2017 5:37 pm UTC
by Thesh
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.

Re: Tabs vs Spaces

Posted: Sat Jun 24, 2017 3:05 am UTC
by ucim
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

Re: Tabs vs Spaces

Posted: Sat Jun 24, 2017 7:29 am UTC
by EvanED
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

Posted: Sat Jun 24, 2017 5:24 pm UTC
by ucim
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