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.

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.

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.

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 * Heartfelt thanks from addams and from me - you really made a difference.

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.

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 * Heartfelt thanks from addams and from me - you really made a difference.