You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by "Preston L. Bannister" <pr...@home.com> on 1999/11/08 20:48:12 UTC

tabs - can we not, please?

Minor issue, but...

It looks like at least some of the Jakarta sources are formatted using 8
column tabs.  I would like to suggest that the Jakarta sources *not*
contain TAB characters.

If all your sources come from one place, or all you ever work on is one
platform, then using tabs instead of spaces is no big deal.

If your sources come from different places (naturally each choosing
different tab settings :) and you might use serveral different editors
in the course of one day - the indentation always comes out right if you
use spaces instead of tabs.

The flip side of this is you are more likely to get checkins with messed
up indentation when using tabs...


Re: tabs - can we not, please?

Posted by Harish Prabandham <Ha...@eng.sun.com>.
+1 for 4 space indents
+1 for 8 space tabs
+1 for tabs converted to spaces..

- Harish

"Preston L. Bannister" wrote:

> Minor issue, but...
>
> It looks like at least some of the Jakarta sources are formatted using 8
> column tabs.  I would like to suggest that the Jakarta sources *not*
> contain TAB characters.
>
> If all your sources come from one place, or all you ever work on is one
> platform, then using tabs instead of spaces is no big deal.
>
> If your sources come from different places (naturally each choosing
> different tab settings :) and you might use serveral different editors
> in the course of one day - the indentation always comes out right if you
> use spaces instead of tabs.
>
> The flip side of this is you are more likely to get checkins with messed
> up indentation when using tabs...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org


Re: tabs - can we not, please?

Posted by Craig McClanahan <cm...@mytownnet.com>.
"Preston L. Bannister" wrote:

> Minor issue, but...
>
> It looks like at least some of the Jakarta sources are formatted using 8
> column tabs.  I would like to suggest that the Jakarta sources *not*
> contain TAB characters.
>
> If all your sources come from one place, or all you ever work on is one
> platform, then using tabs instead of spaces is no big deal.
>
> If your sources come from different places (naturally each choosing
> different tab settings :) and you might use serveral different editors
> in the course of one day - the indentation always comes out right if you
> use spaces instead of tabs.
>
> The flip side of this is you are more likely to get checkins with messed
> up indentation when using tabs...
>

Per the Guidelines page on source code
(http://jakarta.apache.org/guidelines/source.html) we are to be using the
"Code Conventions for the Java Programming Language" on Sun's web site.

The relevant rule is at the beginning of Section 4
(http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html), which
states:

    "Four spaces should be used as the unit of indentation.  The
    exact construction of the indentation (spaces vs. tabs) is
    unspecified.  Tabs must be set exactly every 8 spaces (not 4)."

So the current practice of constructing indentation out of spaces and/or
tabs is perfectly in accord with the specified standard, as long as you
correctly set your tab stops (every 8 spaces) for this code.  I'm neutral on
whether we change the standard to spaces-only or not, but I'm opposed to a
"cultural convention" in the group to violate the standard for details we
don't like.  There's several other rules in there I don't follow for my
personal code, but I'm obeying the listed conventions for Jakarta code
because that is what you do on multi-contributor projects.

Craig McClanahan



Re: tabs - can we not, please?

Posted by David Brownell <da...@pacbell.net>.
> I have traded email with Scott Hommel (the current keeper of the coding standards), and he is very open to feedback. Further, he has no idea about the origin or reasoning behind the above paragraph and even hints that it will change in the near future. I will be suggesting a change to the coding standards to use tabs.

It's a standard with an extremely old tradition in UNIX (and hence on
the Internet ... as long as the "80 character line length" standard
(not obeyed by the above quote :-)

I could trace it back historically, but won't -- the point is that
eight spaces per tab is the only really widely adopted standard.

Briefly, without sticking to the conventional eight space tabs,
chaos reigns.  Likewise with line lengths.  (The line quoted above
doesn't format correctly in many widely used mail readers.)

- Dave

Re: tabs - can we not, please?

Posted by Michal Mosiewicz <mi...@interdata.com.pl>.
Paul Philion wrote:
> [...]
> I have traded email with Scott Hommel (the current keeper of the coding standards), and he is very open to feedback. Further, he has no idea about the origin or reasoning behind the above paragraph and even hints that it will change in the near future. I will be suggesting a change to the coding standards to use tabs.

The origin of this paragraph is simple. In certain environments tab
cannot be anything more or less than 8 bytes. This was specifically very
true if you worked using terminals over the network etc. From long, long
time ago tab's been always 8 spaces.

As for indentation - it may be different. And usually indents are not
the same as tabs. It was never intended for tabs to function as indents
(unless we speak of keyboard use not ascii codes).

These coding standards are really useful. Just don't look at them from a
perspective of your prefered editor. The editor is not the only tool
that is commonly used. There are also issues like looking at cvs command
results, diffs, etc in your terminal, using those neat commandline tools
like cat, more, grep, find, etc. If you will assume that tabs aren't
just tabs, and you make them 4 spaces or you assign them other
functions, you will break a huge infrastructure that was being developed
for about 30 years or more.

It's not my intention to start any OS wars here, cause it's not the
right place. It's just a good sample of what those coding standard mean
in practice. Usuall coding standards discussions on lists related to
historically older platforms like unices are absolutely tab-problems
free. This problems doesn't exist there, becouse there are long lived
standards. This problem is related to platforms where
all-in-one-super-editors have become more popular. The fact is that each
Windows based integrated tool has it's own coding standards and they
tend to put less attention to what had existed before they were born.

-- Mike

Re: tabs - can we not, please?

Posted by Ben Laurie <be...@algroup.co.uk>.
Paul Philion wrote:
> Further, I suggest adopting tabs here (1 tab = 4 spaces, all tabs for leading indents). Tools like jindent will make it very easy to clean up the code.

Noooo! This causes all sorts of problems. There's only One True
tabwidth, and that's 8 spaces. 4-space indents and 8-space tabs are also
the rule for Apache, BTW.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Re: tabs - can we not, please?

Posted by Paul Philion <ph...@acmerocket.com>.
I was looking over the Sun Java Coding Standards lately (which Jakarta is following, right?) where this is covered. The spec says:

    4 - Indentation

    Four spaces should be used as the unit of 
    indentation. The exact construction of the
    indentation (spaces vs. tabs) is unspecified.
    Tabs must be set exactly every 8 spaces (not
    4).

So according to the spec, all spaces is fine.

Now, on a personal note: I prefer to use all tabs, where one tab equals one level of indention. This keeps files smaller (fewer characters), gives indentation control to readers (some like 8 spaces, some like 2) who can set their own tabs. Finally, it is easier to set up many editors with simple tab indents.

I have traded email with Scott Hommel (the current keeper of the coding standards), and he is very open to feedback. Further, he has no idea about the origin or reasoning behind the above paragraph and even hints that it will change in the near future. I will be suggesting a change to the coding standards to use tabs.

Further, I suggest adopting tabs here (1 tab = 4 spaces, all tabs for leading indents). Tools like jindent will make it very easy to clean up the code.

- Paul Philion


"Preston L. Bannister" wrote:
> 
> Minor issue, but...
> 
> It looks like at least some of the Jakarta sources are formatted using 8
> column tabs.  I would like to suggest that the Jakarta sources *not*
> contain TAB characters.
> 
> If all your sources come from one place, or all you ever work on is one
> platform, then using tabs instead of spaces is no big deal.
> 
> If your sources come from different places (naturally each choosing
> different tab settings :) and you might use serveral different editors
> in the course of one day - the indentation always comes out right if you
> use spaces instead of tabs.
> 
> The flip side of this is you are more likely to get checkins with messed
> up indentation when using tabs...
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org