Stripping of whitespaces at the end of lines

Geoff Thorpe geoff at geoffthorpe.net
Wed May 29 12:48:59 CDT 2002


Hi there,

First, if you reply to this please just send it to the list - I don't need
personal copies of every email on this thread - what kind of foolishness
is it where everyone hits "reply to all" on list mail??? A little
netiquette please ...

On Wed, 29 May 2002, Dimitrie O. Paun wrote:

> On May 29, 2002 11:59 am, Geoff Thorpe wrote:
> > Absolutely. If you use \t, then anyone looking at the code can choose the
> > size of indents. I *despise* space-based indenting, almost as much as I
> > despise mixed indenting (eg. 4-space indenting with every pair of 4-space
> > indents being converted into a single tab).
>
> Sorry, this does not work. People _will_ use spaces, and so having the tab
> at anything other than 8 is simply silly. The tab (\t) _is_ 8 spaces. Period.
> If we are to have anything decent, we should decide (at least as a
> recommendation) on an indentation size. From looking at the code, 4 seems
> to be the norm. Let's pick that.

Hey, I'm not grappling with your code so this isn't my problem. But this
"tab _is_ 8 spaces" stuff is fact by statement. The mere fact that I can
change, in any editor I choose, the _default_ representation of tab
characters from 8-space alignments to <2|4|whatever>-space alignments
shows that your statement is moot. What any standard or spec has to say
about it matters not one iota. Moreover, to the person who said it was not
possible to use tabs for indentation and let people choose their visual
representation of tabs, simply because of things like;

   if ( aa == bb && .....
        cc == dd && ..)

That assumes that you use expression alignment to guide indentation of
broken lines rather than indentation levels. If you use expression
alignment, then you are from the same school of thought that
bastardisation of HTML is legitimate because GUI-rendering of HTML is the
paramount consideration. There are other schools of thought that state
that source code, like HTML, exists to logically describe context and
mechanics. Logic before aesthetic. Etc. If you want to do ASCII art,
source code is probably not the place.

A tab's role historically was to represent a level of indentation. Quoted
paragraphs, lists, etc - all got an extra level of indentation than the
parent text. You could also use nesting - ie multiple levels of
indentation to represent scope. Sounds a lot like indentation of source
code, doesn't it? Yes, traditionally it's 8 spaces and that's the default
on many editors. Fine. And many people prefer 4 space indentations, and
funnily enough virtually all sane editors allow you to change the
visualisation of the tabs to however many characters you prefer (including
4). This also uses one ASCII character to represent one logical item - a
unit of indentation. OTOH spaces have no logical nor aesthetic
relationship to indentation/alignment, generate much larger files, and
force the visualisation rather than defining context and leaving
visualisation to editor defaults and user preferences. Think HTML with
hardcoded fonts vs HTML with context tags (<B>, <H[1|2|...]>, etc).

Using spaces and disregarding tabs because "tabs _are_ 8 spaces" and "8
spaces is too much" is not rational, and it's not logical. It generates
code that is bigger, less flexible, prone to inconsistencies, and all
because of rules that in reality don't exist.

Cheers,
Geoff





More information about the wine-devel mailing list