June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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. <snip> 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. |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | 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 >> 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. >> >> 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 |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | 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
|
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to stonecobra | "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? |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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 |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to stonecobra | 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 |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to stonecobra | "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. |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "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 intolerably > 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 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. :) I have engaged in this discussion primarilly tongue-in-cheek, in case nobody noticed <g>. |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | 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/ |
June 14, 2004 Re: Tabs & spaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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/ |
Copyright © 1999-2021 by the D Language Foundation