www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Tabs & spaces

reply "The Dr ... who?" <thedr who.com> writes:
Walter

I get your tab scheme - Vim's softtabs / smarttabs - but it's just a PITA when
viewed with any other tools whose default tabs are not 8, or which have been set
to another tab setting.

Is there a good reason why you (and anyone writing for Phobos) can't change to
just spaces only?
Jun 12 2004
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
"The Dr ... who?" <thedr who.com> wrote in message
news:cagnmh$1md2$1 digitaldaemon.com...
 I get your tab scheme - Vim's softtabs / smarttabs - but it's just a PITA

 viewed with any other tools whose default tabs are not 8, or which have

 to another tab setting.

Printers, the linux command prompt, the windows command prompt, the DOS command prompt, the RT-11 command prompt, TOPS-10 command prompt, every TTY I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops at 8. Programs that default to anything other than 8 should be abandoned. Programs that allow tab stops to be customized should be flogged.
 Is there a good reason why you (and anyone writing for Phobos) can't

 just spaces only?

Habit <g>.
Jun 13 2004
next sibling parent reply Ant <Ant_member pathlink.com> writes:
In article <caiaqb$ti1$1 digitaldaemon.com>, Walter says...
"The Dr ... who?" <thedr who.com> wrote in message
news:cagnmh$1md2$1 digitaldaemon.com...
 I get your tab scheme - Vim's softtabs / smarttabs - but it's just a PITA

 viewed with any other tools whose default tabs are not 8, or which have

 to another tab setting.

Printers, the linux command prompt, the windows command prompt, the DOS command prompt, the RT-11 command prompt, TOPS-10 command prompt, every TTY I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops at 8. Programs that default to anything other than 8 should be abandoned. Programs that allow tab stops to be customized should be flogged.

you are stuck in the past, sorry. Ant
Jun 13 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Ant" <Ant_member pathlink.com> wrote in message
news:caihjb$1714$1 digitaldaemon.com...
 In article <caiaqb$ti1$1 digitaldaemon.com>, Walter says...
Printers, the linux command prompt, the windows command prompt, the DOS
command prompt, the RT-11 command prompt, TOPS-10 command prompt, every


I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops


8. Programs that default to anything other than 8 should be abandoned.
Programs that allow tab stops to be customized should be flogged.

you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser printer, the latest Windows XP, and Red Hat Linux 9. All have 8 character tab stops wired in <g>.
Jun 13 2004
parent reply Ant <duitoolkit yahoo.ca> writes:
On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:

 
 "Ant" <Ant_member pathlink.com> wrote in message
 news:caihjb$1714$1 digitaldaemon.com...
 In article <caiaqb$ti1$1 digitaldaemon.com>, Walter says...
Printers, the linux command prompt, the windows command prompt, the DOS
command prompt, the RT-11 command prompt, TOPS-10 command prompt, every


I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops


8. Programs that default to anything other than 8 should be abandoned.
Programs that allow tab stops to be customized should be flogged.

you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser printer, the latest Windows XP, and Red Hat Linux 9. All have 8 character tab stops wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs. inclusive the original poster that asked for spaces! all of them redefine the tab stops. Ant
Jun 13 2004
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Ant" <duitoolkit yahoo.ca> wrote in message
news:pan.2004.06.14.02.07.52.929078 yahoo.ca...
 On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:
 you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser


 the latest Windows XP, and Red Hat Linux 9. All have 8 character tab


 wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs. inclusive the original poster that asked for spaces! all of them redefine the tab stops.

I use microEmacs. Tabs are fixed at 8 <g>. But seriously, if you use non-8 character tabs, the code won't print without using a special print program (when I want to print code, I don't want to look up the printer driver and try to figure out what arcane way to reset the tab stops, print, then set it back, I just want to print it), it won't look right in the source level debugger, it won't work as <pre></pre> in html pages, it won't 'type' to the screen on command prompt, etc. I don't want to run it through a perl script just so I can look at it. Non-8 tabs always going to be out of step with the way everything works. The code will always format like **** when emailed to someone who can't print it without special settings, etc. It might be fine for closely held source, but for widely distributed source, tabs need to kowtow to the default on practically every piece of hardware and software that displays ascii text. I know lots of code editors that have soft tab settings. But as soon as you leave that environment, every other program or hardware that displays text will go awry with the result. Distributed source code should be context-free, i.e. it shouldn't need to come with an external set of instructions saying what format it is in. And nobody ever bothers giving such instructions, so the inevitable result is the code looks like **** when brought up in an editor.
Jun 13 2004
next sibling parent reply Regan Heath <regan netwin.co.nz> writes:
On Sun, 13 Jun 2004 22:05:32 -0700, Walter <newshound digitalmars.com> 
wrote:
 "Ant" <duitoolkit yahoo.ca> wrote in message
 news:pan.2004.06.14.02.07.52.929078 yahoo.ca...
 On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:
 you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser


 the latest Windows XP, and Red Hat Linux 9. All have 8 character tab


 wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs. inclusive the original poster that asked for spaces! all of them redefine the tab stops.

I use microEmacs. Tabs are fixed at 8 <g>. But seriously, if you use non-8 character tabs, the code won't print without using a special print program (when I want to print code, I don't want to look up the printer driver and try to figure out what arcane way to reset the tab stops, print, then set it back, I just want to print it), it won't look right in the source level debugger, it won't work as <pre></pre> in html pages, it won't 'type' to the screen on command prompt, etc. I don't want to run it through a perl script just so I can look at it. Non-8 tabs always going to be out of step with the way everything works. The code will always format like **** when emailed to someone who can't print it without special settings, etc. It might be fine for closely held source, but for widely distributed source, tabs need to kowtow to the default on practically every piece of hardware and software that displays ascii text. I know lots of code editors that have soft tab settings. But as soon as you leave that environment, every other program or hardware that displays text will go awry with the result. Distributed source code should be context-free, i.e. it shouldn't need to come with an external set of instructions saying what format it is in. And nobody ever bothers giving such instructions, so the inevitable result is the code looks like **** when brought up in an editor.

I don't think I understand the problem here.. I use MSVC, I set my tabs to 4 spaces, meaning that when I press TAB it inserts the \t char into my source file and displays it as 4 spaces. So if I open my source in notepad it reads \t and displays it as 8 spaces. It does not look like **** it looks fine, it simply has more horizontal space. From what you're saying if I print it in MSVC it will look like it does in notepad? or are you saying something else? If I need something in the code to line up under all situations i.e. comments on table columns etc, I will use spaces. I know for a fact that a space will take up 1 characters worth of space all the time, everywhere. What I *never* do is use both spaces AND tabs on one line, as this will never look right except under the same conditions as I wrote it. This is assuming they don't display it using non fixed-width fonts, in which case it doesn't matter what you do it won't line up, ever. Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 13 2004
next sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Regan Heath" <regan netwin.co.nz> wrote in message
news:opr9kj2ig85a2sq9 digitalmars.com...
 On Sun, 13 Jun 2004 22:05:32 -0700, Walter <newshound digitalmars.com>
 wrote:
 "Ant" <duitoolkit yahoo.ca> wrote in message
 news:pan.2004.06.14.02.07.52.929078 yahoo.ca...
 On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:
 you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser


 the latest Windows XP, and Red Hat Linux 9. All have 8 character tab


 wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs. inclusive the original poster that asked for spaces! all of them redefine the tab stops.

I use microEmacs. Tabs are fixed at 8 <g>. But seriously, if you use non-8 character tabs, the code won't print without using a special print program (when I want to print code, I don't want to look up the printer driver and try to figure out what arcane way to reset the tab stops, print, then set it back, I just want to print it), it won't look right in the source level debugger, it won't work as <pre></pre> in html pages, it won't 'type' to the screen on command prompt, etc. I don't want to run it through a perl script just so I can look at it. Non-8 tabs always going to be out of step with the way everything works. The code will always format like **** when emailed to someone who can't print it without special settings, etc. It might be fine for closely held source, but for widely distributed source, tabs need to kowtow to the default on practically every piece of hardware and software that displays ascii text. I know lots of code editors that have soft tab settings. But as soon as you leave that environment, every other program or hardware that displays text will go awry with the result. Distributed source code should be context-free, i.e. it shouldn't need to come with an external set of instructions saying what format it is in. And nobody ever bothers giving such instructions, so the inevitable result is the code looks like **** when brought up in an editor.

I don't think I understand the problem here.. I use MSVC, I set my tabs to 4 spaces, meaning that when I press TAB it inserts the \t char into my source file and displays it as 4 spaces. So if I open my source in notepad it reads \t and displays it as 8 spaces. It does not look like **** it looks fine, it simply has more horizontal space. From what you're saying if I print it in MSVC it will look like it does in notepad? or are you saying something else? If I need something in the code to line up under all situations i.e. comments on table columns etc, I will use spaces. I know for a fact that a space will take up 1 characters worth of space all the time, everywhere. What I *never* do is use both spaces AND tabs on one line, as this will never look right except under the same conditions as I wrote it. This is assuming they don't display it using non fixed-width fonts, in which case it doesn't matter what you do it won't line up, ever.

Walter uses an indentation scheme that I'm familiar with via (g)vim. Basically, if the indent is odd (i.e. 1st, 3rd, 5th), then the editor inserts 4 spaces. For even indents (2nd, 4th, etc.) then it inserts a single hard tab. Since such editors use tabstop=8, it all looks dandy. Also, any device which does not redefine the tabstop from 8 will also display correctly. That's the source of Walter's talking about printers, etc. The problem is that the choice of 8 spaces per tabstop is one of those horrible decisions we're perpetually stuck with. Many editors have provided the ability to redefine the tabstop from 8 to a smaller value. This is most often 4, but I've seen 3, 2, 1 and even 5! Anyway, whatever the size, these programs are all, strictly, wrong. So Walter is quite correct that he's correct. <g> However, most of us use such "wrong" editors, and so when one opens up a 4(space)/8(tab) document with, say, 4 spaces, the indentation is shot to hell, and the code looks RS. Since vim allows you to elect to use all spaces, rather than mixed space+tab, and makes backspace still act as if you've deleted a tab (rather than needing to do three more backspaces, like you do in some other dumb ass editors), I cannot believe emacs does not have the same facility. Therefore, it would cost Walter nothing to change to all spaces, and would mean that anyone - either D-philes like us, or "not so sure"s - looking at the code would see all the high quality splendour that is big-W's codified splendour. Failing that, he could attain the same spell-binding of his readers by just including an untabification step in the release of Phobos. Again, virtually no effort, and a manifest gain.
Jun 13 2004
parent reply Regan Heath <regan netwin.co.nz> writes:
On Mon, 14 Jun 2004 15:31:45 +1000, Matthew 
<admin stlsoft.dot.dot.dot.dot.org> wrote:
 "Regan Heath" <regan netwin.co.nz> wrote in message
 news:opr9kj2ig85a2sq9 digitalmars.com...
 On Sun, 13 Jun 2004 22:05:32 -0700, Walter <newshound digitalmars.com>
 wrote:
 "Ant" <duitoolkit yahoo.ca> wrote in message
 news:pan.2004.06.14.02.07.52.929078 yahoo.ca...
 On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:
 you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser


 the latest Windows XP, and Red Hat Linux 9. All have 8 character 



 stops
 wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs. inclusive the original poster that asked for spaces! all of them redefine the tab stops.

I use microEmacs. Tabs are fixed at 8 <g>. But seriously, if you use non-8 character tabs, the code won't print without using a special print program (when I want to print code, I don't

 look up the printer driver and try to figure out what arcane way to 

 the tab stops, print, then set it back, I just want to print it), it
 won't
 look right in the source level debugger, it won't work as <pre></pre> 

 html pages, it won't 'type' to the screen on command prompt, etc. I 

 want to run it through a perl script just so I can look at it. Non-8 

 always going to be out of step with the way everything works. The code
 will
 always format like **** when emailed to someone who can't print it
 without
 special settings, etc. It might be fine for closely held source, but 

 widely distributed source, tabs need to kowtow to the default on
 practically
 every piece of hardware and software that displays ascii text.

 I know lots of code editors that have soft tab settings. But as soon 

 you
 leave that environment, every other program or hardware that displays
 text
 will go awry with the result.

 Distributed source code should be context-free, i.e. it shouldn't 

 come with an external set of instructions saying what format it is in.
 And
 nobody ever bothers giving such instructions, so the inevitable 

 the code looks like **** when brought up in an editor.

I don't think I understand the problem here.. I use MSVC, I set my tabs to 4 spaces, meaning that when I press TAB it inserts the \t char into my source file and displays it as 4 spaces. So if I open my source in notepad it reads \t and displays it as 8 spaces. It does not look like **** it looks fine, it simply has more horizontal space. From what you're saying if I print it in MSVC it will look like it does in notepad? or are you saying something else? If I need something in the code to line up under all situations i.e. comments on table columns etc, I will use spaces. I know for a fact that a space will take up 1 characters worth of space all the time, everywhere. What I *never* do is use both spaces AND tabs on one line, as this will never look right except under the same conditions as I wrote it. This is assuming they don't display it using non fixed-width fonts, in which case it doesn't matter what you do it won't line up, ever.

Walter uses an indentation scheme that I'm familiar with via (g)vim. Basically, if the indent is odd (i.e. 1st, 3rd, 5th), then the editor inserts 4 spaces. For even indents (2nd, 4th, etc.) then it inserts a single hard tab.

So you're saying it mixes spaces and tabs on a single line? i.e. I pressed tab once \tI pressed tab twice \t I pressed tab 3 times \t\tI pressed tab 4 times \t\t I pressed tab 5 times yes? If so, yuck! no wonder there is a problem! What crack addled chimpanzee decided that was a good idea??!
 Since such
 editors use tabstop=8, it all looks dandy. Also, any device which does 
 not
 redefine the tabstop from 8 will also display correctly. That's the 
 source of
 Walter's talking about printers, etc.

So you cannot tell a printer to use a different tabstop?
 The problem is that the choice of 8 spaces per tabstop is one of those 
 horrible
 decisions we're perpetually stuck with.

Hindsight is 20-20.
 Many editors have provided the ability to
 redefine the tabstop from 8 to a smaller value. This is most often 4, 
 but I've
 seen 3, 2, 1 and even 5! Anyway, whatever the size, these programs are 
 all,
 strictly, wrong. So Walter is quite correct that he's correct. <g>

These programs are only strictly wrong if they are supposed to be WYSIWYG editors. If not, then there is nothing wrong with displaying a tab as 4 spaces, and saving it in the file as a single tab. I prefer WYTIWYG (what you type is what you get) and I'll display it however you tell me to editors.
 However, most of us use such "wrong" editors, and so when one opens up a
 4(space)/8(tab) document with, say, 4 spaces, the indentation is shot to 
 hell,
 and the code looks RS.

Indeed.
 Since vim allows you to elect to use all spaces, rather than mixed 
 space+tab, and
 makes backspace still act as if you've deleted a tab (rather than 
 needing to do
 three more backspaces, like you do in some other dumb ass editors), I 
 cannot
 believe emacs does not have the same facility. Therefore, it would cost 
 Walter
 nothing to change to all spaces, and would mean that anyone - either 
 D-philes
 like us, or "not so sure"s - looking at the code would see all the high 
 quality
 splendour that is big-W's codified splendour.

LOL. flattery will get you no-where methinks.
 Failing that, he could attain the same spell-binding of his readers by 
 just
 including an untabification step in the release of Phobos. Again, 
 virtually no
 effort, and a manifest gain.

Either soln sounds good.. Walter? Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 13 2004
next sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Regan Heath" <regan netwin.co.nz> wrote in message
news:opr9klqrto5a2sq9 digitalmars.com...
 On Mon, 14 Jun 2004 15:31:45 +1000, Matthew
 <admin stlsoft.dot.dot.dot.dot.org> wrote:
 "Regan Heath" <regan netwin.co.nz> wrote in message
 news:opr9kj2ig85a2sq9 digitalmars.com...
 On Sun, 13 Jun 2004 22:05:32 -0700, Walter <newshound digitalmars.com>
 wrote:
 "Ant" <duitoolkit yahoo.ca> wrote in message
 news:pan.2004.06.14.02.07.52.929078 yahoo.ca...
 On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:
 you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser


 the latest Windows XP, and Red Hat Linux 9. All have 8 character



 stops
 wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs. inclusive the original poster that asked for spaces! all of them redefine the tab stops.

I use microEmacs. Tabs are fixed at 8 <g>. But seriously, if you use non-8 character tabs, the code won't print without using a special print program (when I want to print code, I don't

 look up the printer driver and try to figure out what arcane way to

 the tab stops, print, then set it back, I just want to print it), it
 won't
 look right in the source level debugger, it won't work as <pre></pre>

 html pages, it won't 'type' to the screen on command prompt, etc. I

 want to run it through a perl script just so I can look at it. Non-8

 always going to be out of step with the way everything works. The code
 will
 always format like **** when emailed to someone who can't print it
 without
 special settings, etc. It might be fine for closely held source, but

 widely distributed source, tabs need to kowtow to the default on
 practically
 every piece of hardware and software that displays ascii text.

 I know lots of code editors that have soft tab settings. But as soon

 you
 leave that environment, every other program or hardware that displays
 text
 will go awry with the result.

 Distributed source code should be context-free, i.e. it shouldn't

 come with an external set of instructions saying what format it is in.
 And
 nobody ever bothers giving such instructions, so the inevitable

 the code looks like **** when brought up in an editor.

I don't think I understand the problem here.. I use MSVC, I set my tabs to 4 spaces, meaning that when I press TAB it inserts the \t char into my source file and displays it as 4 spaces. So if I open my source in notepad it reads \t and displays it as 8 spaces. It does not look like **** it looks fine, it simply has more horizontal space. From what you're saying if I print it in MSVC it will look like it does in notepad? or are you saying something else? If I need something in the code to line up under all situations i.e. comments on table columns etc, I will use spaces. I know for a fact that a space will take up 1 characters worth of space all the time, everywhere. What I *never* do is use both spaces AND tabs on one line, as this will never look right except under the same conditions as I wrote it. This is assuming they don't display it using non fixed-width fonts, in which case it doesn't matter what you do it won't line up, ever.

Walter uses an indentation scheme that I'm familiar with via (g)vim. Basically, if the indent is odd (i.e. 1st, 3rd, 5th), then the editor inserts 4 spaces. For even indents (2nd, 4th, etc.) then it inserts a single hard tab.

So you're saying it mixes spaces and tabs on a single line? i.e. I pressed tab once \tI pressed tab twice \t I pressed tab 3 times \t\tI pressed tab 4 times \t\t I pressed tab 5 times yes?

If, translating your invisible spaces for ., you mean ....I pressed tab once \tI pressed tab twice \t....I pressed tab 3 times \t\tI pressed tab 4 times \t\t....I pressed tab 5 times then yes
 If so, yuck! no wonder there is a problem! What crack addled chimpanzee
 decided that was a good idea??!

LOL!!! That's a fantastic one. I must remember that. <G> I've been meaning to put up a web page with "SE Abuses" for ages. I think you've inspired me to put it on again. Or maybe we can just pick the juciest for an Appendix in the D book? :)
 Since such
 editors use tabstop=8, it all looks dandy. Also, any device which does
 not
 redefine the tabstop from 8 will also display correctly. That's the
 source of
 Walter's talking about printers, etc.

So you cannot tell a printer to use a different tabstop?

I imagine you can, but that's not the point. In this regard, Walter has a good point. It's just his remedy that I don't like
 The problem is that the choice of 8 spaces per tabstop is one of those
 horrible
 decisions we're perpetually stuck with.

Hindsight is 20-20.

:)
 Many editors have provided the ability to
 redefine the tabstop from 8 to a smaller value. This is most often 4,
 but I've
 seen 3, 2, 1 and even 5! Anyway, whatever the size, these programs are
 all,
 strictly, wrong. So Walter is quite correct that he's correct. <g>

These programs are only strictly wrong if they are supposed to be WYSIWYG editors. If not, then there is nothing wrong with displaying a tab as 4 spaces, and saving it in the file as a single tab. I prefer WYTIWYG (what you type is what you get) and I'll display it however you tell me to editors.
 However, most of us use such "wrong" editors, and so when one opens up a
 4(space)/8(tab) document with, say, 4 spaces, the indentation is shot to
 hell,
 and the code looks RS.

Indeed.
 Since vim allows you to elect to use all spaces, rather than mixed
 space+tab, and
 makes backspace still act as if you've deleted a tab (rather than
 needing to do
 three more backspaces, like you do in some other dumb ass editors), I
 cannot
 believe emacs does not have the same facility. Therefore, it would cost
 Walter
 nothing to change to all spaces, and would mean that anyone - either
 D-philes
 like us, or "not so sure"s - looking at the code would see all the high
 quality
 splendour that is big-W's codified splendour.

LOL. flattery will get you no-where methinks.

And sarcasm will get me the door! But sarcasm flows in the veins of Englishmen. I constantly forget to put in the requisite ";)" and it gets me in all kind of trouble. (I recently offended just about every giant of the C++ with my, ahem, ahem, "wit". That was not a pleasant exercise in genuflectory recanting. Thankfully most of the D ng grok that I talk crap most of the time and ignore it. You're all more like my wife than you'd imagine ...) Anyway, Walter knows that I think his code looks like it's as rough as a badger's arse, but that I also acknowledge that he has the upperhand in the argument, given the fact that the stuff he does with it damned impressive. I reckon I'm pretty typical as a developer in thinking everyone else's style is intolerably ugly. Several times in the past I've been instrumental in writing coding standards for clients - I have my mature concessional head on at such times <g> - and it's always the source of huge controversy. It's kind of amusing that there's always more attention, and _much_ more heat, on the coding standards than on the source control standards, or release procedures. Fools are we all. :)
 Failing that, he could attain the same spell-binding of his readers by
 just
 including an untabification step in the release of Phobos. Again,
 virtually no
 effort, and a manifest gain.

Either soln sounds good.. Walter? Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

Jun 13 2004
next sibling parent "Walter" <newshound digitalmars.com> writes:
"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message
news:cajh25$2p8d$1 digitaldaemon.com...
 I reckon I'm
 pretty typical as a developer in thinking everyone else's style is

 ugly.

Yup. That's the norm.
 Several times in the past I've been instrumental in writing coding
 standards for clients - I have my mature concessional head on at such

 and it's always the source of huge controversy. It's kind of amusing that

 always more attention, and _much_ more heat, on the coding standards than

 source control standards, or release procedures. Fools are we all. :)

I have engaged in this discussion primarilly tongue-in-cheek, in case nobody noticed <g>.
Jun 14 2004
prev sibling parent Regan Heath <regan netwin.co.nz> writes:
On Mon, 14 Jun 2004 16:36:45 +1000, Matthew 
<admin stlsoft.dot.dot.dot.dot.org> wrote:
 Walter uses an indentation scheme that I'm familiar with via (g)vim.
 Basically,
 if the indent is odd (i.e. 1st, 3rd, 5th), then the editor inserts 4
 spaces. For
 even indents (2nd, 4th, etc.) then it inserts a single hard tab.

So you're saying it mixes spaces and tabs on a single line? i.e. I pressed tab once \tI pressed tab twice \t I pressed tab 3 times \t\tI pressed tab 4 times \t\t I pressed tab 5 times yes?

If, translating your invisible spaces for ., you mean ....I pressed tab once \tI pressed tab twice \t....I pressed tab 3 times \t\tI pressed tab 4 times \t\t....I pressed tab 5 times then yes

Yep, that is what I mean't.
 If so, yuck! no wonder there is a problem! What crack addled chimpanzee
 decided that was a good idea??!

LOL!!! That's a fantastic one. I must remember that. <G>

It's one of my favourites.. I have some others, but they're not really for public consumption.
 I've been meaning to put up a web page with "SE Abuses" for ages. I 
 think you've
 inspired me to put it on again. Or maybe we can just pick the juciest 
 for an
 Appendix in the D book? :)

"SE Abuses" == ? Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Regan Heath" <regan netwin.co.nz> wrote in message
news:opr9klqrto5a2sq9 digitalmars.com...
 If so, yuck! no wonder there is a problem! What crack addled chimpanzee
 decided that was a good idea??!

[Raising hand] -- crack addled chimpanzee P.S. Adding a tab-to-space converter for release raises the spectre of having same-only-different versions of the source, something that isn't worth it. P.P.S. "So you cannot tell a printer to use a different tabstop?" Sure I can. If I can find where I put the documention on it. And for my source debugger, and Explorer, and the command prompt, and the linux printer driver, and on and on, and for everyone else who wants to look at the code as well. No thanks. Switching tab stops is like using a Dvorak keyboard. Sure, qwerty sucks, but it sucks worse to be unable to type on any keyboard but your own - and like your friend will let you install a Dvorak driver on his laptop so you can check your email <g>.
Jun 13 2004
next sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:cajhs4$2qca$1 digitaldaemon.com...
 "Regan Heath" <regan netwin.co.nz> wrote in message
 news:opr9klqrto5a2sq9 digitalmars.com...
 If so, yuck! no wonder there is a problem! What crack addled chimpanzee
 decided that was a good idea??!

[Raising hand] -- crack addled chimpanzee P.S. Adding a tab-to-space converter for release raises the spectre of having same-only-different versions of the source, something that isn't worth it. P.P.S. "So you cannot tell a printer to use a different tabstop?" Sure I can. If I can find where I put the documention on it. And for my source debugger, and Explorer, and the command prompt, and the linux printer driver, and on and on, and for everyone else who wants to look at the code as well. No thanks. Switching tab stops is like using a Dvorak keyboard. Sure, qwerty sucks, but it sucks worse to be unable to type on any keyboard but your own - and like your friend will let you install a Dvorak driver on his laptop so you can check your email <g>.

Isn't that exactly the point? Qwerty sucks. You think that all-spaces sucks. But it's the only way to get unambiguous and maximal compatiblity. Anyway, I'm wiling away too much time on an issue I don't actually care about. (Fancy that!?). So I'll shut up. As the signature says ... -- Matthew Wilson Author: "Imperfect C++", Addison-Wesley, 2004 (http://www.imperfectcplusplus.com) Contributing editor, C/C++ Users Journal (http://www.synesis.com.au/articles.html#columns) STLSoft moderator (http://www.stlsoft.org) " I fold like a cheap hooker who got hit in the stomach by a fat guy with sores on his face" -- Joey -------------------------------------------------------------------------------
Jun 13 2004
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Tabs in source code is evil (IMNSHO).

Lars Ivar Igesund
Jun 14 2004
next sibling parent reply stonecobra <scott stonecobra.com> writes:
Caring about this issue is evil, IMHO.  Whoever wrote the code wrote the 
code, you are welcome to write code the way you do.  Code talks...

My, what a lovely bikeshed you have :)

Can we worry about D here, instead of coding standards?  Even if Walter 
were to untabify, he would untabify at 8 spaces per tab, which all of 
you would dislike.  Why not just live with the code that was written for 
you?

Scott

Lars Ivar Igesund wrote:
 Tabs in source code is evil (IMNSHO).
 
 Lars Ivar Igesund

Jun 14 2004
next sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"stonecobra" <scott stonecobra.com> wrote in message
news:cakh8a$1b5u$1 digitaldaemon.com...
 Caring about this issue is evil, IMHO.  Whoever wrote the code wrote the
 code, you are welcome to write code the way you do.  Code talks...

... and?
 My, what a lovely bikeshed you have :)

Over my head.
 Can we worry about D here, instead of coding standards?

Not caring about coding standards at all. Caring about how D looks, both to people that need to use it on a day to day basis but already like it, and to people who may have reasons to look for things to criticise in it.
  Even if Walter
 were to untabify, he would untabify at 8 spaces per tab, which all of
 you would dislike.

You've clearly not understood the issue. If he untabified at 8sp per tab, we would be very happy indeed.
 Why not just live with the code that was written for
 you?

We will, whether it looks nice and is readily comprehended or not. I raised the issue to ease the task, in a small way, for many people. Cumulatively there will be a lot of time spent arsing around trying to get the D sources into a form that is readable. Almost all of that time will be better spent writing D libraries, or D programs. Or do you not think readibility is a factor in understanding?
Jun 14 2004
parent reply stonecobra <scott stonecobra.com> writes:
Matthew wrote:

 "stonecobra" <scott stonecobra.com> wrote in message
 news:cakh8a$1b5u$1 digitaldaemon.com...
 
Caring about this issue is evil, IMHO.  Whoever wrote the code wrote the
code, you are welcome to write code the way you do.  Code talks...

... and?

bull%$&* (all posts on this subject) walks.
 
 
My, what a lovely bikeshed you have :)

Over my head.

http://www.unixguide.net/freebsd/faq/16.19.shtml
 
 
Can we worry about D here, instead of coding standards?

Not caring about coding standards at all. Caring about how D looks, both to people that need to use it on a day to day basis but already like it, and to people who may have reasons to look for things to criticise in it.

How is this not a coding standard?
 
 
 Even if Walter
were to untabify, he would untabify at 8 spaces per tab, which all of
you would dislike.

You've clearly not understood the issue. If he untabified at 8sp per tab, we would be very happy indeed.

I do understand the issue, but the people with 4 spaces/tab editors that use tabs to code with will be unhappy because the code is indented too much.
 
 
Why not just live with the code that was written for
you?

We will, whether it looks nice and is readily comprehended or not. I raised the issue to ease the task, in a small way, for many people. Cumulatively there will be a lot of time spent arsing around trying to get the D sources into a form that is readable. Almost all of that time will be better spent writing D libraries, or D programs. Or do you not think readibility is a factor in understanding?

I do think readability is a factor in understanding, which is why I prefer the VisualBasic way, where the editor re-writes every line of code to comply to a readability standard, whether you like it or not. But I am not going to tell people how to code to some common readability standard, especially when they are clearly against it and unlikely to change. Hence the bikeshed comment. I apologize everyone, this will be my last post on the subject of tabs and spaces. Scott Sanders
Jun 14 2004
next sibling parent Ant <Ant_member pathlink.com> writes:
In article <cakqm0$1pmr$1 digitaldaemon.com>, stonecobra says...
http://www.unixguide.net/freebsd/faq/16.19.shtml

You're right, but this is the 3rd or 4th time this subject comes up and only people with the wrong idea speak up. This time I thought I could strait things up ;) however Matthew and Walter are right. on shared projects a minimum set of rules is beneficial. for example: Linux contributions should use 8 spaces tabs (and 25x80) and they explain why: With 8 spaces tabs you will notice when or code is getting too complex. Ant
Jun 14 2004
prev sibling next sibling parent "Walter" <newshound digitalmars.com> writes:
"stonecobra" <scott stonecobra.com> wrote in message
news:cakqm0$1pmr$1 digitaldaemon.com...
 http://www.unixguide.net/freebsd/faq/16.19.shtml

Thanks for the spot on target reference. I read Parkinson's books as a kid, but I'd forgotten that one.
Jun 14 2004
prev sibling next sibling parent Regan Heath <regan netwin.co.nz> writes:
On Mon, 14 Jun 2004 11:25:12 -0700, stonecobra <scott stonecobra.com> 
wrote:
 Even if Walter
 were to untabify, he would untabify at 8 spaces per tab, which all of
 you would dislike.

You've clearly not understood the issue. If he untabified at 8sp per tab, we would be very happy indeed.

I do understand the issue, but the people with 4 spaces/tab editors that use tabs to code with will be unhappy because the code is indented too much.

You do, this is exactly my point also.
 Why not just live with the code that was written for
 you?

We will, whether it looks nice and is readily comprehended or not. I raised the issue to ease the task, in a small way, for many people. Cumulatively there will be a lot of time spent arsing around trying to get the D sources into a form that is readable. Almost all of that time will be better spent writing D libraries, or D programs. Or do you not think readibility is a factor in understanding?

I do think readability is a factor in understanding, which is why I prefer the VisualBasic way, where the editor re-writes every line of code to comply to a readability standard, whether you like it or not.

Sorry, this is evil, evil, and a 3rd time evil. The same was done in Frontpage the html editor, the problem with it was, that it got re-written to use MS only methods which do not work in other web servers. And it removed all my cgi replaceable tokens. So it was basically useless. So I use TextPad.
 But I am not going to tell people how to code to some common readability 
 standard, especially when they are clearly against it and unlikely to 
 change.  Hence the bikeshed comment.

 I apologize everyone, this will be my last post on the subject of tabs 
 and spaces.

Don't appologise, your opinion is valid. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
prev sibling parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
 Even if Walter
were to untabify, he would untabify at 8 spaces per tab, which all of
you would dislike.

You've clearly not understood the issue. If he untabified at 8sp per tab, we would be very happy indeed.

I do understand the issue, but the people with 4 spaces/tab editors that use tabs to code with will be unhappy because the code is indented too much.

Wrong. Go back to the earlier post describing the indentation scheme, and work it out again.
Why not just live with the code that was written for
you?

We will, whether it looks nice and is readily comprehended or not. I raised


 issue to ease the task, in a small way, for many people. Cumulatively there


 be a lot of time spent arsing around trying to get the D sources into a form


 is readable. Almost all of that time will be better spent writing D


 D programs.

 Or do you not think readibility is a factor in understanding?

I do think readability is a factor in understanding, which is why I prefer the VisualBasic way, where the editor re-writes every line of code to comply to a readability standard, whether you like it or not. But I am not going to tell people how to code to some common readability standard, especially when they are clearly against it and unlikely to change. Hence the bikeshed comment. I apologize everyone, this will be my last post on the subject of tabs and spaces.

I shall try and emulate your reticence. ;)
Jun 14 2004
prev sibling parent Regan Heath <regan netwin.co.nz> writes:
On Mon, 14 Jun 2004 08:44:14 -0700, stonecobra <scott stonecobra.com> 
wrote:
 Caring about this issue is evil, IMHO.  Whoever wrote the code wrote the 
 code, you are welcome to write code the way you do.  Code talks...

 My, what a lovely bikeshed you have :)

 Can we worry about D here, instead of coding standards?  Even if Walter 
 were to untabify, he would untabify at 8 spaces per tab, which all of 
 you would dislike.

Un-tabbifying is not the soln, using \t instead of 4 spaces is. If you have \t then your editor can decide how to display it. If you have \t you can easily convert every odd one into 4 spaces to print it, etc..
 Why not just live with the code that was written for you?

Sure, but, it'd be nice to be able to read it as well. Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
prev sibling parent Regan Heath <regan netwin.co.nz> writes:
On Mon, 14 Jun 2004 10:05:32 +0100, Lars Ivar Igesund 
<larsivar igesund.net> wrote:
 Tabs in source code is evil (IMNSHO).

IMHO they're better than spaces. Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
prev sibling parent Regan Heath <regan netwin.co.nz> writes:
On Sun, 13 Jun 2004 23:52:23 -0700, Walter <newshound digitalmars.com> 
wrote:
 "Regan Heath" <regan netwin.co.nz> wrote in message
 news:opr9klqrto5a2sq9 digitalmars.com...
 If so, yuck! no wonder there is a problem! What crack addled chimpanzee
 decided that was a good idea??!

[Raising hand] -- crack addled chimpanzee

:)
 P.S. Adding a tab-to-space converter for release raises the spectre of
 having same-only-different versions of the source, something that isn't
 worth it.

I agree.
 P.P.S. "So you cannot tell a printer to use a different tabstop?" Sure I
 can. If I can find where I put the documention on it. And for my source
 debugger, and Explorer, and the command prompt, and the linux printer
 driver, and on and on, and for everyone else who wants to look at the 
 code
 as well. No thanks. Switching tab stops is like using a Dvorak keyboard.
 Sure, qwerty sucks, but it sucks worse to be unable to type on any 
 keyboard
 but your own - and like your friend will let you install a Dvorak driver 
 on
 his laptop so you can check your email <g>.

Sad but true. So basically you should give up your 'dvorak' text editor and use a broken one like the rest of us? IMO not mixing tabs and spaces, and using an editor that displays tabs as x spaces gives you the most flexibility, and everyone else the most flexibility, to be honest how often do you print source code? Representing a tab as 4 spaces in one instance and as a \t in the other just seems wrong to me. It's a gut reaction. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Regan Heath" <regan netwin.co.nz> wrote in message
news:opr9kj2ig85a2sq9 digitalmars.com...
 What I *never* do is use both spaces AND tabs on one line, as this will
 never look right except under the same conditions as I wrote it.

Despite most programmers mixing the two (including me), your technique only works for leading tabs. Using tabs to line up, say, right hand comments (a common style) fails even if you eshew spaces.
Jun 13 2004
parent reply Regan Heath <regan netwin.co.nz> writes:
On Sun, 13 Jun 2004 23:34:15 -0700, Walter <newshound digitalmars.com> 
wrote:
 "Regan Heath" <regan netwin.co.nz> wrote in message
 news:opr9kj2ig85a2sq9 digitalmars.com...
 What I *never* do is use both spaces AND tabs on one line, as this will
 never look right except under the same conditions as I wrote it.

Despite most programmers mixing the two (including me), your technique only works for leading tabs. Using tabs to line up, say, right hand comments (a common style) fails even if you eshew spaces.

You've got me backwards.. I specifically said I use spaces to line things up. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
parent "Walter" <newshound digitalmars.com> writes:
"Regan Heath" <regan netwin.co.nz> wrote in message
news:opr9lt690b5a2sq9 digitalmars.com...
 On Sun, 13 Jun 2004 23:34:15 -0700, Walter <newshound digitalmars.com>
 wrote:
 "Regan Heath" <regan netwin.co.nz> wrote in message
 news:opr9kj2ig85a2sq9 digitalmars.com...
 What I *never* do is use both spaces AND tabs on one line, as this will
 never look right except under the same conditions as I wrote it.

Despite most programmers mixing the two (including me), your technique only works for leading tabs. Using tabs to line up, say, right hand comments (a common style) fails even if you eshew spaces.

You've got me backwards.. I specifically said I use spaces to line things up.

Ok, my mistake.
Jun 15 2004
prev sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:cajbos$2ggr$1 digitaldaemon.com...
 "Ant" <duitoolkit yahoo.ca> wrote in message
 news:pan.2004.06.14.02.07.52.929078 yahoo.ca...
 On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:
 you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser


 the latest Windows XP, and Red Hat Linux 9. All have 8 character tab


 wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs. inclusive the original poster that asked for spaces! all of them redefine the tab stops.

I use microEmacs. Tabs are fixed at 8 <g>. But seriously, if you use non-8 character tabs, the code won't print without using a special print program (when I want to print code, I don't want to look up the printer driver and try to figure out what arcane way to reset the tab stops, print, then set it back, I just want to print it), it won't look right in the source level debugger, it won't work as <pre></pre> in html pages, it won't 'type' to the screen on command prompt, etc. I don't want to run it through a perl script just so I can look at it. Non-8 tabs always going to be out of step with the way everything works. The code will always format like **** when emailed to someone who can't print it without special settings, etc. It might be fine for closely held source, but for widely distributed source, tabs need to kowtow to the default on practically every piece of hardware and software that displays ascii text. I know lots of code editors that have soft tab settings. But as soon as you leave that environment, every other program or hardware that displays text will go awry with the result. Distributed source code should be context-free, i.e. it shouldn't need to come with an external set of instructions saying what format it is in. And nobody ever bothers giving such instructions, so the inevitable result is the code looks like **** when brought up in an editor.

Aren't you just backing up my argument that you untabify your source before bundling. As it stands, it's not context-free, since it assumes tabstops are 8. There's no good saying that others are wrong, since there's a proliferation of editors that use soft tabs, set to the "scientifically optimal" 4. If you want your code to appear correctly irrespective of context, it needs to be untabified. Otherwise, you're going to look like Betamax, and everyone else'll be seeing your code through the eyes of VHS. Of course, I could just remember to untabify (with -t8) the DMD source every time I download. But I already think it's amazing quality, it's others you should be concerned with. =P
Jun 13 2004
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Matthew wrote:

<snip>
 Aren't you just backing up my argument that you untabify your source 
 before bundling. As it stands, it's not context-free, since it 
 assumes tabstops are 8.
 
 There's no good saying that others are wrong, since there's a 
 proliferation of editors that use soft tabs, set to the 
 "scientifically optimal" 4. If you want your code to appear correctly 
 irrespective of context, it needs to be untabified.

Yes, most coding environments do seem to be set to a tab size of 4. Indeed, I would somehow doubt there to be any universal standard here. If anything, then I guess someone decided 8 would be a good number for his/her/its purposes, and various people followed suit. OTOH, programmers felt that 8 was too wide, and the 4-space tab caught on in that community. I don't know about the old Fortraners, when they had to indent every statement by 8 chars anyway.... There are three options being discussed here... 1. Tabs only Pros: - disk space efficient - easy and painless to type - when viewed in an editor with customisable tab sizes, appears at the size the user finds most comfortable Cons: - when viewed at bigger tab size, long, deeply indented lines are more likely to fall off the screen 2. Spaces only Pros: - consistent display - some editors can auto-convert tabs to spaces, making this form easy to produce - layout preserved in situations where tab chars may not be transmitted/rendered properly Cons: - take up more disk space - tedious to type in primitive editors (e.g. Notepad) - harder to maintain by others who prefer tabs, if their tab width is different (e.g. two-space indentation seems to tend to come out of Emacs users....) 3. Tabs with space half-indentation Pros: - finer, more 'comfortable' indentation than some tab width hard-coded in certain contexts - less tedious than all-space indenting in Notepad - slightly more compact on disk than all-space indenting Cons: - looks a mess/hard to follow in environments having different tab width OK, so option 2 has the most cons, but the first is fairly minor and the rest are somewhat dependent on other factors. And I imagine most programmers don't edit their code in Notepad, which isn't very suited to the task anyway. The con of 1 isn't all that serious when you consider that people aren't all going to be viewing at the same window width anyway. OTOH, when I try to maintain code written in technique 3, I invariably find myself 'tidying' the indentation so that it makes sense in my comfort settings. NTS, I prefer 1, and tend to release code with the tabs still in place. But if I'm putting code on a web page, then I change them to spaces. When posting code to a newsgroup I don't seem to be consistent, and I'm not sure how different newsreaders handle tab chars.... Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Jun 14 2004
parent reply Regan Heath <regan netwin.co.nz> writes:
On Mon, 14 Jun 2004 12:17:26 +0100, Stewart Gordon <smjg_1998 yahoo.com> 
wrote:
 Matthew wrote:

 <snip>
 Aren't you just backing up my argument that you untabify your source 
 before bundling. As it stands, it's not context-free, since it assumes 
 tabstops are 8.

 There's no good saying that others are wrong, since there's a 
 proliferation of editors that use soft tabs, set to the "scientifically 
 optimal" 4. If you want your code to appear correctly irrespective of 
 context, it needs to be untabified.

Yes, most coding environments do seem to be set to a tab size of 4. Indeed, I would somehow doubt there to be any universal standard here. If anything, then I guess someone decided 8 would be a good number for his/her/its purposes, and various people followed suit. OTOH, programmers felt that 8 was too wide, and the 4-space tab caught on in that community. I don't know about the old Fortraners, when they had to indent every statement by 8 chars anyway.... There are three options being discussed here... 1. Tabs only Pros: - disk space efficient - easy and painless to type - when viewed in an editor with customisable tab sizes, appears at the size the user finds most comfortable Cons: - when viewed at bigger tab size, long, deeply indented lines are more likely to fall off the screen 2. Spaces only Pros: - consistent display - some editors can auto-convert tabs to spaces, making this form easy to produce

or anyone can, trivially, with a small program.
 - layout preserved in situations where tab chars may not be 
 transmitted/rendered properly
 Cons:
 - take up more disk space
 - tedious to type in primitive editors (e.g. Notepad)
 - harder to maintain by others who prefer tabs, if their tab width is 
 different (e.g. two-space indentation seems to tend to come out of Emacs 
 users....)

 3. Tabs with space half-indentation
 Pros:
 - finer, more 'comfortable' indentation than some tab width hard-coded 
 in certain contexts

do you mean "in an editor with hard coded tabstops of 8 spaces it looks nicer than tabs does"?
 - less tedious than all-space indenting in Notepad

this is also a con, if you re-word it as.. - slightly more tedious than all-tab indenting in notepad.
 - slightly more compact on disk than all-space indenting

this is also a con, if you re-word it as.. - slightly less compact on disk than all-tab indenting.
 Cons:
 - looks a mess/hard to follow in environments having different tab width

These lists are excellent. It's important to nore that if "tabs only" is used it does not mean you cannot use spaces where you want/need to. I do this in msdev to align specific things like comments on columns to a static array of data etc. They stay aligned regardless of the tabstop as I do not mix spaces and tabs in doing it.
 OK, so option 2 has the most cons, but the first is fairly minor and the 
 rest are somewhat dependent on other factors.  And I imagine most 
 programmers don't edit their code in Notepad, which isn't very suited to 
   the task anyway.  The con of 1 isn't all that serious when you 
 consider that people aren't all going to be viewing at the same window 
 width anyway.  OTOH, when I try to maintain code written in technique 3, 
 I invariably find myself 'tidying' the indentation so that it makes 
 sense in my comfort settings.

 NTS, I prefer 1, and tend to release code with the tabs still in place.

This is my preference also.
   But if I'm putting code on a web page, then I change them to spaces. 
 When posting code to a newsgroup I don't seem to be consistent, and I'm 
 not sure how different newsreaders handle tab chars...

Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Regan Heath wrote:

<snip>
 2. Spaces only
 Pros:
 - consistent display
 - some editors can auto-convert tabs to spaces, making this form easy 
 to produce

or anyone can, trivially, with a small program.

Well, there are plenty of programs out there that aren't small. D is supposed to be suited to million-line projects according to the docs.
 - layout preserved in situations where tab chars may not be 
 transmitted/rendered properly
 Cons:
 - take up more disk space
 - tedious to type in primitive editors (e.g. Notepad)
 - harder to maintain by others who prefer tabs, if their tab width is 
 different (e.g. two-space indentation seems to tend to come out of 
 Emacs users....)

 3. Tabs with space half-indentation
 Pros:
 - finer, more 'comfortable' indentation than some tab width hard-coded 
 in certain contexts

do you mean "in an editor with hard coded tabstops of 8 spaces it looks nicer than tabs does"?

Yes. But also situations where code is merely displayed and/or transmitted, rather than edited, under the same constraint.
 - less tedious than all-space indenting in Notepad

this is also a con, if you re-word it as.. - slightly more tedious than all-tab indenting in notepad.
 - slightly more compact on disk than all-space indenting

this is also a con, if you re-word it as.. - slightly less compact on disk than all-tab indenting.

Yes, I was kind of thinking that myself. I guess that, on average, the number of spaces would outweigh the halving of the number of tab characters.... <snip>
 It's important to nore that if "tabs only" is used it does not mean you 
 cannot use spaces where you want/need to. I do this in msdev to align 
 specific things like comments on columns to a static array of data etc. 
 They stay aligned regardless of the tabstop as I do not mix spaces and 
 tabs in doing it.

Yes, there's giving code a tabular layout. And boxed comments. Not to mention my tendency to indent subsequent lines of a statement by 2 spaces. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Jun 15 2004
parent Regan Heath <regan netwin.co.nz> writes:
On Tue, 15 Jun 2004 11:54:28 +0100, Stewart Gordon <smjg_1998 yahoo.com> 
wrote:
 Regan Heath wrote:

 <snip>
 2. Spaces only
 Pros:
 - consistent display
 - some editors can auto-convert tabs to spaces, making this form easy 
 to produce

or anyone can, trivially, with a small program.

Well, there are plenty of programs out there that aren't small. D is supposed to be suited to million-line projects according to the docs.

I think you have missunderstood. What I mean't here was that even if your editor couldn't convert it (tabs to spaces), you could write an app to do it for you. Thus you could produce an all spaces form easily.
 - layout preserved in situations where tab chars may not be 
 transmitted/rendered properly
 Cons:
 - take up more disk space
 - tedious to type in primitive editors (e.g. Notepad)
 - harder to maintain by others who prefer tabs, if their tab width is 
 different (e.g. two-space indentation seems to tend to come out of 
 Emacs users....)

 3. Tabs with space half-indentation
 Pros:
 - finer, more 'comfortable' indentation than some tab width hard-coded 
 in certain contexts

do you mean "in an editor with hard coded tabstops of 8 spaces it looks nicer than tabs does"?

Yes. But also situations where code is merely displayed and/or transmitted, rather than edited, under the same constraint.

True. This is Walters main argument for this tab/space style I believe.
 - less tedious than all-space indenting in Notepad

this is also a con, if you re-word it as.. - slightly more tedious than all-tab indenting in notepad.
 - slightly more compact on disk than all-space indenting

this is also a con, if you re-word it as.. - slightly less compact on disk than all-tab indenting.

Yes, I was kind of thinking that myself. I guess that, on average, the number of spaces would outweigh the halving of the number of tab characters.... <snip>
 It's important to nore that if "tabs only" is used it does not mean you 
 cannot use spaces where you want/need to. I do this in msdev to align 
 specific things like comments on columns to a static array of data etc. 
 They stay aligned regardless of the tabstop as I do not mix spaces and 
 tabs in doing it.

Yes, there's giving code a tabular layout. And boxed comments. Not to mention my tendency to indent subsequent lines of a statement by 2 spaces.

This would be my preffered coding style also. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 15 2004
prev sibling parent reply Derek <derek psyc.ward> writes:
On Sun, 13 Jun 2004 22:07:52 -0400, Ant wrote:

 On Sun, 13 Jun 2004 18:47:21 -0700, Walter wrote:
 
 
 "Ant" <Ant_member pathlink.com> wrote in message
 news:caihjb$1714$1 digitaldaemon.com...
 In article <caiaqb$ti1$1 digitaldaemon.com>, Walter says...
Printers, the linux command prompt, the windows command prompt, the DOS
command prompt, the RT-11 command prompt, TOPS-10 command prompt, every


I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops


8. Programs that default to anything other than 8 should be abandoned.
Programs that allow tab stops to be customized should be flogged.

you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser printer, the latest Windows XP, and Red Hat Linux 9. All have 8 character tab stops wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs.

Hmmm...actually I don't. I never use them anymore. Haven't for many, many years now. The SPACE character is a fixed width but the TAB is variable, depending on many factors. The default is nearly always 8 spaces, but as that can be changed by nearly every (modern) editor and printing program, I gave up trying to keep code lined up using tabs.
 inclusive the original poster that asked for spaces!
 all of them redefine the tab stops.

The editors I use (EmEditor and Code-genie) automatically insert the right number of spaces when I press the TAB key. Oh well, its good to have a variety of opinions. Keeps the mind active. -- Derek Melbourne, Australia
Jun 14 2004
parent Regan Heath <regan netwin.co.nz> writes:
On Mon, 14 Jun 2004 22:43:41 +1000, Derek <derek psyc.ward> wrote:
 "Ant" <Ant_member pathlink.com> wrote in message
 news:caihjb$1714$1 digitaldaemon.com...
 In article <caiaqb$ti1$1 digitaldaemon.com>, Walter says...
Printers, the linux command prompt, the windows command prompt, the 

command prompt, the RT-11 command prompt, TOPS-10 command prompt, 


I've used from ASR-33 to VT-100, html browsers, etc., all have tab 


8. Programs that default to anything other than 8 should be 

Programs that allow tab stops to be customized should be flogged.

you are stuck in the past, sorry.

Sorry, I'm using the latest Microsoft Explorer, the latest HP laser printer, the latest Windows XP, and Red Hat Linux 9. All have 8 character tab stops wired in <g>.

They are also living in the past ;) printer? printer? who prints things anymore? that's 20th century ;) But, that list doesn't contain a code editor. All posters on this thread use tabs.

Hmmm...actually I don't. I never use them anymore. Haven't for many, many years now. The SPACE character is a fixed width but the TAB is variable, depending on many factors. The default is nearly always 8 spaces, but as that can be changed by nearly every (modern) editor and printing program, I gave up trying to keep code lined up using tabs.

I see what you're saying.. what were you trying to line up? I use tabs, and my code lines up all the time regardless of the tabstop used. The reason it lines up is that I never mix tabs and spaces. I can send someone an example if they want, it might help show what I mean. In the somewhat rare event that I need to line something up with something else specifically i.e. comments on static table data, I use spaces so that it will always line up no matter what tabstop is used.
 inclusive the original poster that asked for spaces!
 all of them redefine the tab stops.

The editors I use (EmEditor and Code-genie) automatically insert the right number of spaces when I press the TAB key. Oh well, its good to have a variety of opinions. Keeps the mind active.

We're spoilt for choice. Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 14 2004
prev sibling next sibling parent "The Dr ... who?" <thedr who.com> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:caiaqb$ti1$1 digitaldaemon.com...
 "The Dr ... who?" <thedr who.com> wrote in message
 news:cagnmh$1md2$1 digitaldaemon.com...
 I get your tab scheme - Vim's softtabs / smarttabs - but it's just a PITA

 viewed with any other tools whose default tabs are not 8, or which have

 to another tab setting.

Printers, the linux command prompt, the windows command prompt, the DOS command prompt, the RT-11 command prompt, TOPS-10 command prompt, every TTY I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops at 8.

Well, yeah, we know, but ...
 Programs that default to anything other than 8 should be abandoned.

... they are out there, and they are legion, and your code looks crapola in them.
 Programs that allow tab stops to be customized should be flogged.

as above
 Is there a good reason why you (and anyone writing for Phobos) can't

 just spaces only?

Habit <g>.

Sure. My habit is to use hard tabs, with tabstops set at four. But before I release stuff I run scripts - http://synsoft.org/perl.html; the tabstop can be set with -t<tabstop> - to untabify everything en masse. It's a 0.1% effort thing.
Jun 13 2004
prev sibling parent reply "Vathix" <vathixSpamFix dprogramming.com> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:caiaqb$ti1$1 digitaldaemon.com...
 "The Dr ... who?" <thedr who.com> wrote in message
 news:cagnmh$1md2$1 digitaldaemon.com...
 I get your tab scheme - Vim's softtabs / smarttabs - but it's just a


 when
 viewed with any other tools whose default tabs are not 8, or which have

 to another tab setting.

Printers, the linux command prompt, the windows command prompt, the DOS command prompt, the RT-11 command prompt, TOPS-10 command prompt, every

 I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops

 8. Programs that default to anything other than 8 should be abandoned.
 Programs that allow tab stops to be customized should be flogged.

 Is there a good reason why you (and anyone writing for Phobos) can't

 just spaces only?

Habit <g>.

I like having my tab width set to 3 spaces. I can see more code on the screen horizontally and still see the indentation well. I think that tabs should be used for indentation and spaces used for alignment, so that it looks fine to everyone's settings.
Jun 13 2004
parent Regan Heath <regan netwin.co.nz> writes:
On Sun, 13 Jun 2004 17:49:00 -0400, Vathix 
<vathixSpamFix dprogramming.com> wrote:
 "Walter" <newshound digitalmars.com> wrote in message
 news:caiaqb$ti1$1 digitaldaemon.com...
 "The Dr ... who?" <thedr who.com> wrote in message
 news:cagnmh$1md2$1 digitaldaemon.com...
 I get your tab scheme - Vim's softtabs / smarttabs - but it's just a


 when
 viewed with any other tools whose default tabs are not 8, or which 

been set
 to another tab setting.

Printers, the linux command prompt, the windows command prompt, the DOS command prompt, the RT-11 command prompt, TOPS-10 command prompt, every

 I've used from ASR-33 to VT-100, html browsers, etc., all have tab stops

 8. Programs that default to anything other than 8 should be abandoned.
 Programs that allow tab stops to be customized should be flogged.

 Is there a good reason why you (and anyone writing for Phobos) can't

 just spaces only?

Habit <g>.

I like having my tab width set to 3 spaces. I can see more code on the screen horizontally and still see the indentation well. I think that tabs should be used for indentation and spaces used for alignment, so that it looks fine to everyone's settings.

I agree. I use a tab width of 4 for the same reasons. If you convert tabs to spaces then I cannot choose how to view your code, I am stuck viewing it how you want it. If you want something to be aligned regardless of tab sizes, then use spaces. If the code editor does not use a fixed width font, then all bets are off anyway where alignment is concerned. Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 13 2004
prev sibling next sibling parent Ant <Ant_member pathlink.com> writes:
In article <cagnmh$1md2$1 digitaldaemon.com>, The Dr ... who? says...
Walter

I get your tab scheme - Vim's softtabs / smarttabs - but it's just a PITA when
viewed with any other tools whose default tabs are not 8, or which have been set
to another tab setting.

Is there a good reason why you (and anyone writing for Phobos) can't change to
just spaces only?

I would say use tabs only. If tabs and spaces are not mixed you'll have no problems. there are some disadvantages on using spaces for indentation. if tabs only are used you can set the indentation width to whatever you like. just to let every body know that tabs are better then spaces for indentation people migth have the wrong impression after your post. if Walter decides phobos must have indentation with spaces we all loose (but it's a small thing). Ant
Jun 13 2004
prev sibling next sibling parent Andy Friesen <andy ikagames.com> writes:
The Dr ... who? wrote:
 I get your tab scheme - Vim's softtabs / smarttabs - but it's just a PITA when
 viewed with any other tools whose default tabs are not 8, or which have been
set
 to another tab setting.
 
 Is there a good reason why you (and anyone writing for Phobos) can't change to
 just spaces only?

It's things like these that keep me from ever using hard tabs for anything, particularly in Python where the actual meaning of the code will get slaughtered along with the pretty formatting if anything should go awry. :) -- andy
Jun 13 2004
prev sibling next sibling parent reply Stephen Waits <steve waits.net> writes:
Oh no.. a holy war has ensued.

There's a braindead simple solution to this.  Here it is:

FOLLOW THESE RULES:
===================
1. USE TABS FOR INDENTATION
2. USE SPACES FOR ALIGNMENT


Follow those two rules and everyone will be happy when they view your 
code, regardless of their chosen tab display size (2, 3, 4, 8, ...).

I've trained my team to work like this.  It's painless, and every guy is 
happy, AND our code looks great.

--Steve
Jun 15 2004
parent Stephen Waits <steve waits.net> writes:
Stephen Waits wrote:

 FOLLOW THESE RULES:
 ===================
 1. USE TABS FOR INDENTATION
 2. USE SPACES FOR ALIGNMENT

Following up with an example (printf call intentionally contrived): void func() { int x; // x-value float y = 0.0f; // y-value printf( "x = %d, y = %f\n", x, y ); } And here it is again, substitute tab characters with '^' and space characters with '_'. void_func() { ^int___x;_________//_x-value ^float_y_=_0.0f;__//_y-value ^printf( ^_______"x_=_%d,_y_=_%f\n", ^_______x,_y ^______); } Such a simple solution. Easy to do, produces great looking code. --Steve
Jun 15 2004
prev sibling parent Brad Anderson <brad sankaty.dot.com> writes:
After reading the posts in this thread, I've come to the only logical 
conclusion one can make.  You guys need better recreational pharmaceuticals.

BA


The Dr ... who? wrote:
 Walter
 
 I get your tab scheme - Vim's softtabs / smarttabs - but it's just a PITA when
 viewed with any other tools whose default tabs are not 8, or which have been
set
 to another tab setting.
 
 Is there a good reason why you (and anyone writing for Phobos) can't change to
 just spaces only?
 
 
 

Jun 18 2004