[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: perlstyle and portability
Gurusamy Sarathy <gsar@ActiveState.com> writes:
> On 29 Jan 2000 13:49:37 PST, Russ Allbery wrote:
>> Pure space indentation looks better in diffs and stands less chance of
>> accidental corruption by mailers and the like. Pure tabs at least adds
>> some consistency. The mixed style is a touch annoying and ends up
>> doing surprising things.
> Only if you set your tabstops to a non-standard value (something other
> than 8). If you do that, you pay the price for being non-standard.
Yes, some of the time, but I'm not sure I agree with that as a blanket
statement. Perhaps if *everyone* used an editor that automatically tured
every eight spaces into a tab, but given an indent that's smaller than a
tab and people using a variety of editors, I argue that mixed tabs and
spaces cause surprises even if you have your tab stops set to eight.
The most common example that I see is when you've got something indented
like:
if (i < 1) {
j++;
}
(using pure spaces for clarity) and you patch it to add an increment of k
and generate a diff. The diff often ends up looking like:
if (i < 1) {
j++;
+ i++;
}
or something similar if the code has been edited by various people with
different tab conventions. Anything that puts things on the left margin
(cvs annotate is another one) has a tendency to do things like this.
Another problem not related to tabs vs. spaces exactly but just with the
whole problem of inconsistent whitespace is that some editors will change
the whitespace in lines that they touch even if they don't change anything
else on the line, which creates bigger diffs and pointless changes.
Anyway, this is mostly off-topic, so I'll stop now. It's just a pet peeve
of mine. I agree that you pretty much have to start with choosing the
same standard tab stops as everyone else, but I like to go a step further
and encourage people to stop using tabs unless they're using an
indentation style where every indentation is always a tab.
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
- References to:
-
Gurusamy Sarathy <gsar@ActiveState.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]