September 10, 2006
On Sun, 10 Sep 2006 11:15:02 +0100, Steve Horne <stephenwantshornenospam100@aol.com> wrote:

> On Sun, 10 Sep 2006 00:47:21 +0100, Stewart Gordon
> <smjg_1998@yahoo.com> wrote:
>
>> "# Hardware tabs are at 8 column increments.
>> # Each indentation level will be four columns."
>>
>> Firstly, what is a "hardware tab"?  Secondly, these two quotations seem
>> contradictory.
>
> "Soft tab" usually means indent levels done in spaces. Any decent text
> editors will insert spaces when you press the tab key these days.
> "Hard tab" means the ASCII tab character, which is evil.

It's not evil, it's miss-understood. If you use it for it's original purpose (IMO, to define your left hand margin) and nothing else, it works perfectly in every text editor. Granted in an editor which cannot define a tab width of anything other than 8 it will use a lot of horizontal space, likewise printing(*) to paper or a console.. but I think it would be fair to say "very few people do that sort of thing these days" and if you do, should you be allowed to force your coding style on others (for any public source/project), I think not.

(*) Unless the editor is smart enough to translate \t into the specified number of spaces when printing. An operation made trivial by the existance of the \t character instead of some random number of spaces!

Regan
September 10, 2006
Regan Heath wrote:
> On Sun, 10 Sep 2006 11:13:11 -0700, Walter Bright <newshound@digitalmars.com> wrote:
>> Thomas Kuehne wrote:
>>> Walter Bright schrieb am 2006-09-10:
>>>> Stewart Gordon wrote:
>>>>> AFAIC, people who use tabs but indent by half a tab at a time are painting themselves into a corner.  We should aim to write code that'll be readable in any editor, whatever its tab size setting.
>>>> There's no way to do that and have hard tabs. The only way to achieve that is by using spaces only. Using spaces only is one way to conform to the D style guide.
>>>  What editor/IDE are you using?
>>>  gedit(GNOME), kedit(KDE) and vi/nano(shell) are all basic editors and
>>> all have a way to set the display with of "\t" characters. Microsoft's
>>> Notepad is probably the only default editor incapable of changing the
>>> display with of "\t".
>>
>> That's true, but is not the problem. Consider:
>>
>>     foo();             // comment
>>     bar + 4 *18 - foo();    // comment
>>
>> Suppose \t's are used to line up the comments.
> 
> That's where the mistake/error has been made, NEVER use \t to line text up, ALWAYS use space.
> 
> Tabs are for indentation only, or in other words, indenting the text essentially defining your left hand margin, nothing else!
> 
> As long as you only use tabs to indent the left hand margin, and spaces to align text people can use any tab size they like and it will always work perfectly.

Try viewing Walter's code with a tab width of less than 8.  Since his indentation depth (4 chars) is less than the hard tab width, functions typically look like this:

void fn()
{
int x;
for(;;)
{
    blah blah;
}
}

I thought this was actually a deliberate indenting style until I changed my tab width to 8 and suddenly most of the code became properly indented (I say most because some places are indented with all spaces instead of tabs--probably from submitted patches).


Sean
September 10, 2006
On Sun, 10 Sep 2006 11:13:11 -0700, Walter Bright wrote:

> Furthermore, if you're working with D and source that has had many different hands working on it, do you want to change your environment's hard tab settings every time you switch files? I don't.

Can one force other people to use "hard tabs"? Obviously no. So therefore I do not use them, I just use spaces.

-- 
Derek Parnell
Melbourne, Australia
"Down with mediocrity!"
September 10, 2006
On Mon, 11 Sep 2006 01:03:20 +0300, Serg Kovrov wrote:

> Come on people, please stop this... With all respect, I believe this is dead end. Walter's opinion here is well known. Not all agree with him (including me - to be honest I completely disagree). BUT! We really can't change anything.
> 
> The only wrong thing I see here is heading itself - 'The D Style'. Its too much responsibility to have 'the style' for a language... It could be 'The Phobos Style' or 'Walter's Style'. Or perhaps 'Martian Style' =)
> 
> PS. Don't get me wrong - I have nothing against an off-topic discussions, But this time we are just waisting valuable time. Our time, and most importantly, Walter's.

Yes, this is a pointless discussion. Walter has his style, and the rest of the world has their many and varied styles.

If this style as documented in the DigitalMars documentation is *the* 'D'-style then I will be among the conscientious objectors and I will fail to use it.

-- 
Derek Parnell
Melbourne, Australia
"Down with mediocrity!"
September 10, 2006
On Mon, 11 Sep 2006 10:08:21 +1200, "Regan Heath" <regan@netwin.co.nz> wrote:

>It's not evil, it's miss-understood. If you use it for it's original purpose

It wasn't meant totally seriously.

Mind you, the real original purpose of the tab was data compression. On teletypes, sending long sequences of spaces was inefficient. At 300 baud it was a big deal.

I find my text documents more readable in their decompressed form ;-)

-- 
Remove 'wants' and 'nospam' from e-mail.
September 10, 2006
On Mon, 11 Sep 2006 01:03:20 +0300, Serg Kovrov <kovrov@no.spam> wrote:

>PS. Don't get me wrong - I have nothing against an off-topic discussions, But this time we are just waisting valuable time. Our time, and most importantly, Walter's.

Only if he's daft enough to keep reading ;-)

-- 
Remove 'wants' and 'nospam' from e-mail.
September 10, 2006
On Sun, 10 Sep 2006 15:22:21 -0700, Sean Kelly <sean@f4.ca> wrote:
> Regan Heath wrote:
>> On Sun, 10 Sep 2006 11:13:11 -0700, Walter Bright <newshound@digitalmars.com> wrote:
>>> Thomas Kuehne wrote:
>>>> Walter Bright schrieb am 2006-09-10:
>>>>> Stewart Gordon wrote:
>>>>>> AFAIC, people who use tabs but indent by half a tab at a time are painting themselves into a corner.  We should aim to write code that'll be readable in any editor, whatever its tab size setting.
>>>>> There's no way to do that and have hard tabs. The only way to achieve that is by using spaces only. Using spaces only is one way to conform to the D style guide.
>>>>  What editor/IDE are you using?
>>>>  gedit(GNOME), kedit(KDE) and vi/nano(shell) are all basic editors and
>>>> all have a way to set the display with of "\t" characters. Microsoft's
>>>> Notepad is probably the only default editor incapable of changing the
>>>> display with of "\t".
>>>
>>> That's true, but is not the problem. Consider:
>>>
>>>     foo();             // comment
>>>     bar + 4 *18 - foo();    // comment
>>>
>>> Suppose \t's are used to line up the comments.
>>  That's where the mistake/error has been made, NEVER use \t to line text up, ALWAYS use space.
>>  Tabs are for indentation only, or in other words, indenting the text essentially defining your left hand margin, nothing else!
>>  As long as you only use tabs to indent the left hand margin, and spaces to align text people can use any tab size they like and it will always work perfectly.
>
> Try viewing Walter's code with a tab width of less than 8. Since his indentation depth (4 chars) is less than the hard tab width, functions typically look like this:
>
> void fn()
> {
> int x;
> for(;;)
> {
>      blah blah;
> }
> }
>
> I thought this was actually a deliberate indenting style until I changed my tab width to 8 and suddenly most of the code became properly indented (I say most because some places are indented with all spaces instead of tabs--probably from submitted patches).

I know all about Walters code, he's mixing tabs and spaces for indentation, that's the problem. If he only used tab for indenting his left hand margin, and only use spaces when he wanted to line text up (from the tabbed margin onward) then there would be no problems, ever, with any tab width.

In other words, it should go: Any number of \t followed by any number of spaces, but never tab, space, space, space, space, tab, etc

Regan
September 10, 2006
On Sun, 10 Sep 2006 23:31:35 +0100, Steve Horne <stephenwantshornenospam100@aol.com> wrote:

> On Mon, 11 Sep 2006 10:08:21 +1200, "Regan Heath" <regan@netwin.co.nz>
> wrote:
>
>> It's not evil, it's miss-understood. If you use it for it's original
>> purpose
>
> It wasn't meant totally seriously.

Neither was I :) Specifically the phrase "It's not evil, it's miss-understood" ;)

> Mind you, the real original purpose of the tab was data compression.
> On teletypes, sending long sequences of spaces was inefficient. At 300
> baud it was a big deal.

Interesting.

> I find my text documents more readable in their decompressed form ;-)

As do we all.. :)

Regan

September 10, 2006
Walter Bright wrote:
<snip>
>> AFAIC, people who use tabs but indent by half a tab at a time are painting themselves into a corner.  We should aim to write code that'll be readable in any editor, whatever its tab size setting.
> 
> There's no way to do that and have hard tabs. The only way to achieve that is by using spaces only. Using spaces only is one way to conform to the D style guide.

I'm not quite with you.  True, using spaces only is one way.  But if a given coder uses only '\t' to indent (as I do), what is there to lose?

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
September 10, 2006
Regan Heath wrote:
> On Sun, 10 Sep 2006 11:15:02 +0100, Steve Horne <stephenwantshornenospam100@aol.com> wrote:
<snip>
>> "Soft tab" usually means indent levels done in spaces. Any decent text
>> editors will insert spaces when you press the tab key these days.
>> "Hard tab" means the ASCII tab character, which is evil.
> 
> It's not evil, it's miss-understood. If you use it for it's original purpose (IMO, to define your left hand margin) and nothing else, it works perfectly in every text editor.
<snip>

I'm inclined to believe that "tab" originated as a contraction of "tabulate".  Good old-fashioned typewriters always gave you control over them, similar to that found in word processors - though I admit it took me a while to figure it out.  OK, so they may have only allowed you to set _left_ tabs, but that's an aside.  And therefore, they could be used to align text in rows and columns - though in modern word processors, the table facility does a far better job.

But in plain text, it's indeed better to use it only to indent.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.