[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Request For Comments: 3-space indentation style
- From: William Ahern <william@...>
- Date: Tue, 7 Jan 2014 14:45:28 -0800
On Tue, Jan 07, 2014 at 07:04:13AM +0000, Craig Barnes wrote:
> On 6 January 2014 21:27, William Ahern wrote:
> > If you use tabs for indentation and spaces for alignment, then your tab stop
> > is inconsequential. No matter your tab stop, anything you align within an
> > indented block will stay aligned.
>
> Yes, you keep saying that, but it's just not true.
>
> > Indentation always comes on the left-hand side. Anything you align inside of
> > a block will always have the same number of tabs, and will always shift
> > right or left as one block. It will all remain aligned correctly.
>
> A specific block may always have the same number of tabs, but what
> about when you want to align something not just constrained to one
> block? Line comments in a nested table are one example -- but there
> are countless other real-world examples out there.
>
> Try this example with a tab stop of 8/4/3/2:
>
> http://cra.igbarn.es/tabs.lua
>
> You can invent all kinds of specious limitations, but the only way to
> freely align things and have it work in other people's editors is to
> avoid using tabs.
That same exact problem occurs with spaces for alignment. If you align
comments across different blocks, then, yes, you have problems with tabs.
But what happens when the next guy adds another definition into your block
using his tab key?**
Your "solution" is to say that _everybody_ should use _your_ indentation
style. But you could also just as well mandate that everybody use the same
tab stop. Neither of those solutions are even remotely practical, yet for
some reason everybody says the latter is less practical than the former.
Every line of Linux kernel code uses tabs for indentation. Almost every line
of code in the FreeBSD, OpenBSD, and NetbBSD repositories uses tabs for
indentation. Up until the onslaught of Windows programmers, the vast
majority of open source code on the Internet used tabs for indentation.
Somehow those projects managed to massively collaborate. The pluarlity also
used 8-space tab stops, yet the vast majority of that code reads perfectly
well if you change your tab stop.
Here's my solution: treat indentation semantically, stop trying to draw
ASCII art in the right hand column across blocks, and stop trying to think
that I can get everybody to agree on the width of indentation.
** Also, what happens when a programmer adds so many nested levels that not
even 1-space widths will be enough to keep the alignment? That's why it's
not a great idea to do that kind of thing. Ut's a waste of time to force
people--including oneself--to maintain meticulously crafted, pretty
"comments".
- References:
- Re: Request For Comments: 3-space indentation style, David Given
- Re: Request For Comments: 3-space indentation style, steve donovan
- Re: Request For Comments: 3-space indentation style, Hisham
- Re: Request For Comments: 3-space indentation style, Jorge
- Re: Request For Comments: 3-space indentation style, Andrew Starks
- Re: Request For Comments: 3-space indentation style, phlnc8
- Re: Request For Comments: 3-space indentation style, William Ahern
- Re: Request For Comments: 3-space indentation style, Craig Barnes
- Re: Request For Comments: 3-space indentation style, William Ahern
- Re: Request For Comments: 3-space indentation style, Craig Barnes