www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - The D Style and tab sizes

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
http://www.digitalmars.com/d/dstyle.html

"Adhering to the D Style, however, will make it easier for others to 
work with your D code and easier for you to work with others' D code."




Firstly, what is a "hardware tab"?  Secondly, these two quotations seem 
contradictory.

Making your code come out a mess in any editor that isn't configured 
with a tab size of 8 is certainly not going to make it easier for others 
to work with your D code.  On the contrary, it is much easier if people 
can read your code regardless of how their editors are configured.

Most programmers, at least AFAIK, will decide on an indentation size 
that they feel comfortable with and configure their editors to use this 
as the tab size.  Of course, there will be some who indent with spaces, 
not tabs, and some whose editors (either by user pref or by being 
hard-coded to) automatically convert all tabs to spaces, but that's an 
aside.

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.

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.
Sep 09 2006
next sibling parent reply Walter Bright <newshound digitalmars.com> writes:
Stewart Gordon wrote:
 http://www.digitalmars.com/d/dstyle.html
 
 "Adhering to the D Style, however, will make it easier for others to 
 work with your D code and easier for you to work with others' D code."
 


 
 Firstly, what is a "hardware tab"?
The \t character.
 Secondly, these two quotations seem contradictory.
Soft tabs and hard tabs aren't the same, although they are often confused.
 Making your code come out a mess in any editor that isn't configured 
 with a tab size of 8 is certainly not going to make it easier for others 
 to work with your D code.  On the contrary, it is much easier if people 
 can read your code regardless of how their editors are configured.
 
 Most programmers, at least AFAIK, will decide on an indentation size 
 that they feel comfortable with and configure their editors to use this 
 as the tab size.  Of course, there will be some who indent with spaces, 
 not tabs, and some whose editors (either by user pref or by being 
 hard-coded to) automatically convert all tabs to spaces, but that's an 
 aside.
 
 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.
Sep 09 2006
next sibling parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter Bright schrieb am 2006-09-10:
 Stewart Gordon 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.
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". Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFA9yMLK5blCcjpWoRArGqAJ93UDlDyG5dDWImoq+6odjw3+wB6gCfeu3Y OVq0p+oD75/6zr/qhqTb8Ow= =uhKo -----END PGP SIGNATURE-----
Sep 10 2006
next sibling parent Steve Horne <stephenwantshornenospam100 aol.com> writes:
On Sun, 10 Sep 2006 11:36:18 +0200, Thomas Kuehne
<thomas-dloop kuehne.cn> wrote:

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.
The problem is when you have some indents made of tabs and some made of spaces and some mixed. And then you give the file to some other guy who uses a different tab width. Spaces are always the same width. Indents using spaces will make sense no matter who reads your code or how they configure their editor. Any decent editor can be configured to insert spaces when you hit the tab key. Trust me - this is a good thing. -- Remove 'wants' and 'nospam' from e-mail.
Sep 10 2006
prev sibling parent reply Walter Bright <newshound digitalmars.com> writes:
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. There is no way to have them stay lined up if the strides of \t's change. I started with teletypes (ASR-33's). Moved on to Decwriters, Hazeltine terminals, ADDs terminals, Diablo 630's, FX-80s, IBM PCs, DOS, Windows, CPM-86, OS/2, HP laserprinters, Linux, NT, XP, HTML rendering, Thunderbird email, etc. One thing they *all* had in common was 8 character hard tabs. Sure, in any particular editor or environment, you can change the hard tab to be 3, 4, or whatever, but as soon as your source leaves that environment, it's screwed up. If you have a closed source project, that's no problem. But if it's part of the D open source world, it'll be distributed to every type of device, and the only thing in common will be 8 character hard tabs. 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.
Sep 10 2006
next sibling parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
Many programmer's text editors or IDEs I've worked with use a default 
tab size of 4.  For example, Microsoft Visual Studio and Macromedia 
Dreamweaver use 4.

In web development, Dreamweaver is pretty much the standard, on Windows. 
  In C++, Visual Studio is.

In these editors, by default, the code looks entirely and completely 
unreadable.  However, code I write always looks readable and 
understandable in all editors, including nano, kate, etc. which use 8 as 
a default tab size.

This is because I conform to the following standards:

   - never line things up with tabs, except from the gutter.
   - never line things up with tabs against non-tab characters.
   - always use exactly one tab character per indentation level.

Honestly, when actual tab characters appear in the source, the above 
style is the prevailing style.  People who like otherwise typically use 
spaces only.

Saying that 8 is common and everywhere is simply incorrect.  Even with 
the editors that use 8 as a default, a large portion of programmers set 
it to 4, or even 3.

Whether I'm using a screen width of 1024, 1152, 1280, or 640... I should 
be able to choose how much screen real-estate is eaten by indentation. 
In D's current style, you are forcing a width on them: you believe that 
indentation must be 4 spaces, and so everyone must conform to that.  If 
someone prefers 8 spaces, 3 spaces, or 6 spaces... too bad.  Sucks to be 
them.  They have to live with YOUR style.

Very nice.  I'm glad the D compiler and language was not written the 
same way.  No one would use it.  At least with it, I can program in the 
style I wish to.  I'm not forced to follow some uncommon convention.

-[Unknown]

 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. There is no way to have them stay lined up if the strides of \t's change. I started with teletypes (ASR-33's). Moved on to Decwriters, Hazeltine terminals, ADDs terminals, Diablo 630's, FX-80s, IBM PCs, DOS, Windows, CPM-86, OS/2, HP laserprinters, Linux, NT, XP, HTML rendering, Thunderbird email, etc. One thing they *all* had in common was 8 character hard tabs. Sure, in any particular editor or environment, you can change the hard tab to be 3, 4, or whatever, but as soon as your source leaves that environment, it's screwed up. If you have a closed source project, that's no problem. But if it's part of the D open source world, it'll be distributed to every type of device, and the only thing in common will be 8 character hard tabs. 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.
Sep 10 2006
parent reply Steve Horne <stephenwantshornenospam100 aol.com> writes:
On Sun, 10 Sep 2006 12:38:42 -0700, "Unknown W. Brackets"
<unknown simplemachines.org> wrote:

In D's current style, you are forcing a width on them: you believe that 
indentation must be 4 spaces, and so everyone must conform to that.  If 
someone prefers 8 spaces, 3 spaces, or 6 spaces... too bad.  Sucks to be 
them.  They have to live with YOUR style.
That would be true if the compiler enforced the style rules. But Walter can only enforce his rules within his project - his right, common sense, and I'm sure his main intent. My habit is to indent two spaces at a time. I've posted some snippets in that style. No-one has complained. But if I was contributing to the compiler or library, I'd expect to follow the rules. -- Remove 'wants' and 'nospam' from e-mail.
Sep 10 2006
parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
I meant, the prevailing style of DMD and Phobos - being "D's current style."

In an open source project, a lot of the time it's important to make your 
code available and convenient for others to view, edit, and contribute 
to.  That's part of the whole idea of open source.

You should always choose what's best for you, but keep in mind others as 
well.  There's usually a good, happy, middle place for everyone.

-[Unknown]


 On Sun, 10 Sep 2006 12:38:42 -0700, "Unknown W. Brackets"
 <unknown simplemachines.org> wrote:
 
 In D's current style, you are forcing a width on them: you believe that 
 indentation must be 4 spaces, and so everyone must conform to that.  If 
 someone prefers 8 spaces, 3 spaces, or 6 spaces... too bad.  Sucks to be 
 them.  They have to live with YOUR style.
That would be true if the compiler enforced the style rules. But Walter can only enforce his rules within his project - his right, common sense, and I'm sure his main intent. My habit is to indent two spaces at a time. I've posted some snippets in that style. No-one has complained. But if I was contributing to the compiler or library, I'd expect to follow the rules.
Sep 10 2006
prev sibling next sibling parent reply "Regan Heath" <regan netwin.co.nz> writes:
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. Regan
Sep 10 2006
parent reply Sean Kelly <sean f4.ca> writes:
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
Sep 10 2006
parent "Regan Heath" <regan netwin.co.nz> writes:
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
Sep 10 2006
prev sibling next sibling parent reply Derek Parnell <derek psyc.ward> writes:
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!"
Sep 10 2006
parent Walter Bright <newshound digitalmars.com> writes:
Derek Parnell wrote:
 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.
That's one solution that works.
Sep 10 2006
prev sibling parent BCS <BCS pathlink.com> writes:
Walter Bright wrote:
 Consider:
 
     foo();             // comment
     bar + 4 *18 - foo();    // comment
 
 Suppose \t's are used to line up the comments. There is no way to have 
 them stay lined up if the strides of \t's change.
// comment foo(); // comment bar + 4 *18 - foo(); never put '\t' after anything but a start of line.
Sep 11 2006
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
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.
Sep 10 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
Stewart Gordon wrote:
 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?
What if you want to write: foo(); // comment // more comment and have the comments line up?
Sep 10 2006
next sibling parent reply "Chris Miller" <chris dprogramming.com> writes:
On Sun, 10 Sep 2006 20:03:39 -0400, Walter Bright  
<newshound digitalmars.com> wrote:

 Stewart Gordon wrote:
 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?
What if you want to write: foo(); // comment // more comment and have the comments line up?
<tab> foo(); <spaces> // comment <tab> <spaces> // comment match up tabs for indentation, use spaces for further alignment.
Sep 10 2006
next sibling parent Steve Horne <stephenwantshornenospam100 aol.com> writes:
On Sun, 10 Sep 2006 20:14:49 -0400, "Chris Miller"
<chris dprogramming.com> wrote:

<tab> foo(); <spaces> // comment
<tab>     <spaces>    // comment

match up tabs for indentation, use spaces for further alignment.
If either you or someone else has to refactor and reformat your code, at some point you're going to get spaces where you wanted tabs or tabs where you wanted spaces. As soon as that happens, the world will come to a horrible end. There shall be plagues of rats, boils, plagues, and - worst of all - pot noodles. We, the space-indenting worthy shall be raised unto the sky, and we shall gloat down upon you, the evil tab-doers, and Perl.NET shall be loosed upon you, and great shall be your suffering. So there. -- Remove 'wants' and 'nospam' from e-mail.
Sep 11 2006
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Chris Miller wrote:
<snip>
 <tab> foo(); <spaces> // comment
 <tab>     <spaces>    // comment
 
 match up tabs for indentation, use spaces for further alignment.
Agreed. Actually, I do indent by spaces in one respect: when breaking a long statement across two or more lines, subsequent lines are generally indented by two spaces in my style. For the head of an if, for, while, etc., this two spaces becomes a tab followed by two spaces (thereby never on the same level as the body). This is, AISI, perfectly harmless because there are, in general, no sublevels of such a thing. 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.
Sep 12 2006
prev sibling next sibling parent Derek Parnell <derek nomail.afraid.org> writes:
On Sun, 10 Sep 2006 17:03:39 -0700, Walter Bright wrote:

 Stewart Gordon wrote:
 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?
What if you want to write: foo(); // comment // more comment and have the comments line up?
Exactly why I have problems with mixing the methods. One should only tabs or only spaces but never the two together. And if one uses tabs, then expect other people to complain about it eventually. :-) -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 11/09/2006 10:47:26 AM
Sep 10 2006
prev sibling parent Steve Horne <stephenwantshornenospam100 aol.com> writes:
On Sun, 10 Sep 2006 17:03:39 -0700, Walter Bright
<newshound digitalmars.com> wrote:

What if you want to write:

	foo();	// comment
		// more comment

and have the comments line up?
Yes - among other vertical alignment issues, like large parameter lists. If I have a large expression, I'll probably use vertical alignment to emphasise the structure... varname = ( blahblahblah op ( blahblah op blah ) ); Could split it into multiple statements, but IMO this is usually clearer, as long as there's no repeated subexpressions. Actually, Haskell even makes a similar vertical alignment style part of the language - it's called the 'offside rule' and it reduces the need for parentheses. -- Remove 'wants' and 'nospam' from e-mail.
Sep 11 2006
prev sibling next sibling parent reply Steve Horne <stephenwantshornenospam100 aol.com> writes:
On Sun, 10 Sep 2006 00:47:21 +0100, Stewart Gordon
<smjg_1998 yahoo.com> wrote:




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. -- Remove 'wants' and 'nospam' from e-mail.
Sep 10 2006
parent reply "Regan Heath" <regan netwin.co.nz> writes:
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:




 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
Sep 10 2006
next sibling parent reply Steve Horne <stephenwantshornenospam100 aol.com> writes:
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.
Sep 10 2006
parent reply "Regan Heath" <regan netwin.co.nz> writes:
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
Sep 10 2006
parent reply Steve Horne <stephenwantshornenospam100 aol.com> writes:
On Mon, 11 Sep 2006 10:33:21 +1200, "Regan Heath" <regan netwin.co.nz>
wrote:

 It wasn't meant totally seriously.
Neither was I :) Specifically the phrase "It's not evil, it's miss-understood" ;)
Yeah, missed that, sorry. -- Remove 'wants' and 'nospam' from e-mail.
Sep 11 2006
parent "Regan Heath" <regan netwin.co.nz> writes:
On Mon, 11 Sep 2006 13:48:36 +0100, Steve Horne  
<stephenwantshornenospam100 aol.com> wrote:
 On Mon, 11 Sep 2006 10:33:21 +1200, "Regan Heath" <regan netwin.co.nz>
 wrote:

 It wasn't meant totally seriously.
Neither was I :) Specifically the phrase "It's not evil, it's miss-understood" ;)
Yeah, missed that, sorry.
My bad, I should have included a wink or smiley. It can be hard to convey your exact meaning in written form. I know I have to work harder on it, I think people take me too literally/seriously much of the time. Regan
Sep 11 2006
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
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.
Sep 10 2006
prev sibling parent reply Serg Kovrov <kovrov no.spam> writes:
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.

-- 
serg.
Sep 10 2006
next sibling parent Derek Parnell <derek psyc.ward> writes:
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!"
Sep 10 2006
prev sibling parent Steve Horne <stephenwantshornenospam100 aol.com> writes:
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.
Sep 10 2006