www.digitalmars.com         C & C++   DMDScript  

D - DMD source

reply "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
one more thing, Walter:  you should really keep your tab size equal to your
indentation spacing.  You currently have indent at 4 and tabs at 8 spaces.
What this means is that nobody else can take your source and have it look
right in their editor unless they have 8 space tabs also.  If the indent and
tabs matched, it'd look good no matter what the tab setting was, so long as
tabs were used to indent with consistently.

Nitpicking, I know.  ;)

Sean
Nov 04 2002
next sibling parent reply "Walter" <walter digitalmars.com> writes:
Believe it or not, there is a good reason for that <g>. The reason is that
the console command prompt has 8 character tabs, and so does the printer. I
want the code to look right when typed on the screen and printed.

Any editor that does anything but 8 char tabs should have settable tab
stops. I'd rather set the editor to match the console and printer defaults
than the other way around.

"Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
news:aq5df7$1phe$1 digitaldaemon.com...
 one more thing, Walter:  you should really keep your tab size equal to

 indentation spacing.  You currently have indent at 4 and tabs at 8 spaces.
 What this means is that nobody else can take your source and have it look
 right in their editor unless they have 8 space tabs also.  If the indent

 tabs matched, it'd look good no matter what the tab setting was, so long

 tabs were used to indent with consistently.

 Nitpicking, I know.  ;)

 Sean

Nov 04 2002
parent "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
I figured as much.

You could always use 8 character indentation.  ;)  The point is that things
work out much better if they're set to the same value.

I don't think it's unreasonable to have printouts of the source end up
having 8 character indentation.  At least it'll be indented "properly" no
matter what tabulation is used.  If you use different values, it only ever
looks "right" if the editor is set to exactly the same settings as the
original author.  And it's difficult to convert source in bulk.

Anyway I'll get off my soapbox.

Sean

"Walter" <walter digitalmars.com> wrote in message
news:aq6asm$2nkr$1 digitaldaemon.com...
 Believe it or not, there is a good reason for that <g>. The reason is that
 the console command prompt has 8 character tabs, and so does the printer.

 want the code to look right when typed on the screen and printed.

 Any editor that does anything but 8 char tabs should have settable tab
 stops. I'd rather set the editor to match the console and printer defaults
 than the other way around.

 "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
 news:aq5df7$1phe$1 digitaldaemon.com...
 one more thing, Walter:  you should really keep your tab size equal to

 indentation spacing.  You currently have indent at 4 and tabs at 8


 What this means is that nobody else can take your source and have it


 right in their editor unless they have 8 space tabs also.  If the indent

 tabs matched, it'd look good no matter what the tab setting was, so long

 tabs were used to indent with consistently.

 Nitpicking, I know.  ;)

 Sean


Nov 04 2002
prev sibling parent reply "TRex" <trex shani.net> writes:
Hi,

Why have tabs at all?
I set my IDEs to convert tabs to spaces and this prevents layout problems on
different environments.
These days space is not a problem :-)

Tony


"Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
news:aq5df7$1phe$1 digitaldaemon.com...
 one more thing, Walter:  you should really keep your tab size equal to

 indentation spacing.  You currently have indent at 4 and tabs at 8 spaces.
 What this means is that nobody else can take your source and have it look
 right in their editor unless they have 8 space tabs also.  If the indent

 tabs matched, it'd look good no matter what the tab setting was, so long

 tabs were used to indent with consistently.

 Nitpicking, I know.  ;)

 Sean

Nov 05 2002
next sibling parent Mac Reiter <Mac_member pathlink.com> writes:
In article <aq7ulu$1b30$1 digitaldaemon.com>, TRex says...
Hi,

Why have tabs at all?
I set my IDEs to convert tabs to spaces and this prevents layout problems on
different environments.
These days space is not a problem :-)

Tony

Personally, I do it because I hate having to hit backspace 4 times instead of 1. The editors that I have used which support treating clumps of spaces as if they were a tab, and backspace over all four of them, always seem to end up doing that somewhere that I wasn't expecting it, resulting in my having to add at least 3 spaces back in. Since I tend to type faster than I respond, I usually will have backspaced 2 or more times before I realize the editor has done something "weird", which means I've got a lot of spaces to put back. Probably a silly reason, but strong enough to keep me from using that feature. I've also been burned by editors that had the tab->space option, but seemed to be incapable of actually doing it... Or at least, incapable of doing it consistently, which is worse. I doubt that this is really an issue any more, so it's basically the 4:1 ratio of backspaces that keeps me using tabs. I also always print from my code editor, so it doesn't matter what the tab spacing of the printer is. And a lot of programs exist that can "pretty print" code, including re-indenting it, which should get around any perceived inconsistencies. Unfortunately, most of these tools on Win32 tend to be commercial. You could probably get "indent" to port through Cygwin, which would work. Of course, "indent" has a truly stunning list of options, so it might take you awhile to specify exactly the formatting options that you prefer... And, I must also admit that my programs always print to the printer in graphics mode (hence why the printer tab spacing is irrelevant). In theory, this is slower, but my data transfer connection is faster than the physical printing machinery, and I don't generally print giant gobs of source - usually no more than 10 pages at a time. I tend to be an indentation fascist. When I started work, I used (and still use) 4 space tabs. One of my coworkers used 3 space tabs. We had to work on a project together, and it would get very confusing when we started interspersing code. I was able to force him to switch to 4 spaces through force of will and constant working relationship. I have given up trying to convert anyone else's style, and simply use one or more of the tools I described to "fix" it to what I like. My personal whitespace style is to : 1. Always use the tab key for code structure indentation (if's, loops, etc). 2. Always use space characters for any aesthetic indentation (making remaining function arguments line up nicely, or anything else that happens based on having to fold a long line of source code over). When I do this, I use tab to catch up with the appropriate level of code structure, and then I use spaces for all of the remaining indentation. This frequently means that I have a line that starts with 2 tab characters, for the code structure, and then has 20-30 space characters. I do *NOT* want those characters treated as 2-3 tab characters. So I differentiate between tabs and groups of spaces. This style has the advantage that anyone who loads my code, regardless of their tab setting, will see it properly. Since my code structure, and *only* my code structure, changes with the tab setting, and all aesthetic indentation is hardwired through space characters *after* the code structure tabs, everything is fine. Of course, some editors just can't resist the urge to go in and rewrite my code, or to do their auto-indent with the wrong kinds of characters. I usually don't catch this until it's much too late. But I try to immediately configure my editor to work the way I want. Of course, if you print with proportionally spaced fonts, it all goes wacky. But if you are printing source code in proportionally spaced fonts, you need to visit a psychiatrist, or at least a career counselor... (Why can I *never* post a short message? I mean well...) Mac
Nov 05 2002
prev sibling parent "Walter" <walter digitalmars.com> writes:
"TRex" <trex shani.net> wrote in message
news:aq7ulu$1b30$1 digitaldaemon.com...
 Why have tabs at all?
 I set my IDEs to convert tabs to spaces and this prevents layout problems

 different environments.
 These days space is not a problem :-)

'cuz I'm and old curmudgeon and old habits die hard <g>
Nov 05 2002