From: Keith Thompson on
Richard Heathfield <rjh(a)see.sig.invalid> writes:
> Tim Streater wrote:
> <snip>
>
>> Trouble with tabs is, what is a tab?
>
> A quick way of inserting exactly two spaces into the source.

The One True Tabstop Width is 8.

I have to deal with code that was modified by multiple different
people. Most of them use a tabstop width of 4, but some apparently
use 2, 8, or something else, resulting in code that's not properly
formatted regardless of my own tabstop setting.

Everything I check in has its tabs expanded to spaces. (I use
"expand -t 4" with manual cleanup where necessary.)

--
Keith Thompson (The_Other_Keith) kst-u(a)mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
From: Richard Tobin on
In article <lnmxyvvlt8.fsf(a)nuthaus.mib.org>,
Keith Thompson <kst-u(a)mib.org> wrote:
>Richard Heathfield <rjh(a)see.sig.invalid> writes:

>>> Trouble with tabs is, what is a tab?

>> A quick way of inserting exactly two spaces into the source.

>The One True Tabstop Width is 8.
>
>I have to deal with code that was modified by multiple different
>people. Most of them use a tabstop width of 4, but some apparently
>use 2, 8, or something else, resulting in code that's not properly
>formatted regardless of my own tabstop setting.

I think Richard H was referring to the effect of the tab key in an
editor, rather than the display of a tab character.

For example, I have the tab key set to indent 4 spaces; if I do
that twice I get a tab character which then displays as 8 spaces.

>Everything I check in has its tabs expanded to spaces.

Now that the overhead is (and has long been) unimportant, that's
probably a good idea.

-- Richard
--
Please remember to mention me / in tapes you leave behind.
From: James Harris on
On 26 Feb, 19:28, Keith Thompson <ks...(a)mib.org> wrote:
> Richard Heathfield <r...(a)see.sig.invalid> writes:
> > Tim Streater wrote:
> > <snip>
>
> >> Trouble with tabs is, what is a tab?
>
> > A quick way of inserting exactly two spaces into the source.
>
> The One True Tabstop Width is 8.
>
> I have to deal with code that was modified by multiple different
> people.  Most of them use a tabstop width of 4, but some apparently
> use 2, 8, or something else, resulting in code that's not properly
> formatted regardless of my own tabstop setting.
>
> Everything I check in has its tabs expanded to spaces.  (I use
> "expand -t 4" with manual cleanup where necessary.)

For anything outside Unix or Linux others may find the following tabs
expander and compressor useful

http://codewiki.wikispaces.com/tabs.py

It allows arbitrary and/or repeating tab stop positions and obeys they
usual Unix pipe arrangements. Examples of use are included on the
page.

Although it doesn't require Unix be aware that it does need Python.
I've not tested it under Python 3.x but it works ok under Python 2.x.

James
From: pete on
Richard Heathfield wrote:
>
> Tim Streater wrote:
> <snip>
>
> > Trouble with tabs is, what is a tab?
>
> A quick way of inserting exactly two spaces into the source.

FOUR SPACES!!!

--
pete
From: Eric Sosman on
On 2/26/2010 9:51 AM, Richard Heathfield wrote:
> Tim Streater wrote:
> <snip>
>
>> Trouble with tabs is, what is a tab?
>
> A quick way of inserting exactly two spaces into the source.

The only actual study I ever read of (that's "read of," as
in "I didn't read it myself and can't cite it") found that the
best tab spacing was greater than two and less than four. Even
without further experiment, it's blatantly obvious that these
lower and upper bounds bracket the Best Possible Tab Width, to
wit, pi spaces. This is easily approximated by making the tab
key operate probabilistically, advancing to a three- or four-
space position with probabilities 0.142 and 0.858, respectively.
(If you need a more accurate approximation to the fractional
part of pi, your lines are too long.)

--
Eric Sosman
esosman(a)ieee-dot-org.invalid
First  |  Prev  |  Next  |  Last
Pages: 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Prev: integer
Next: shared memory question