My arguement in favor of tabs

OK this is really getting on my nerves, not that people don't follow my convention, as much as people thinking their wrong convention is more righteous than mine. So I'm going to sum up the case, of spaces vs. indentation. I'll start out this diatribe by stating this is pro-tab, and DC is undeniably wrong, this is the most blatant flaw in the PBP.

  1. Tabs belong in one place in a document; and that place only. That place is in between the left-margin and the first word character. This is the tab-zone.
  2. Nothing other than tabs, belong in this tab-zone
  3. This tab-zone encodes not display, but tabs as code-metadata, the level of indentation for your code or depth, which for my purposes can be used interchangeably.
  4. This metadata can be utilized by external code preprocessors, editors, renderers, searching mechanisms or anything of that sort.
  5. Because you are encoding a level of indentation rather than an element of presentation everyone with a decent modern editor can have their cake and eat it too. ie. you can set your presentational tab-space, or tabspace to 2, your friend can set it to 4, or you can have a script based on the time of day alternate it. It doesn't mater. This will eliminate the conversion toandfro spaces. Changing this indentation will still permit all operators to line up, they will just be shifted more, and that shift will be linear to their level of indentation.

Let me explain further why this metadata is important. Lets say you want to target where in your document the sub foo {} is. You preform a search on google.com's nifty codesearch, it yeilds what? foobar.pl, line 50, char X.

Should X include those spaces, or not? If so how many should it assume for each level of what appears visually as indentation? Should it display depth? You might make the argument that a line should only be 80characters? (or 78 if you are an O'reilly author who likes to justify modern coding practices with terminals from the 60s'. But thats alltogether a different argument, to which I personally subscribe, but because of preference rather than false-reasoning. ) The answer is oblivious to the length of the line, whither it be 5000 characters or 50 characters, the x-axis is important, and by using spaces to encode depth as presentation you are dually losing data, you no longer know the level of indentation, and you now have to assume what the programmer meant through heuristics.

This is all a fault of spaces, and the lack of a universal space->depth variable, but then again, spaces are being used in this context to alternate the presentation, which is fundamentally wrong. Another thing I would like to point out is something the space-proponents like to take advantage of, and it is often moot because it is an undeniable evil, and that is spaces do mark something up, and that is something we all use  @words = split ' ', "foo bar baz" it is unfortunate we use them at all for presentation. But lets not make the same mistake for tabs.

Now finally the catch, I admit there is one thing I have neglected. The only fault in this argument is minor and disappearing more every day, and that is legacy editors, or non-programming editors. Lets be blunt now:
Qualitatively how useful is a programmer who uses notepad?, What does it say about a programmer who uses notepad?, How productive can the programmer be if he opts to use tools that are so inept in the productivity dept?

You are only as good as your tools, "\t" is one that shouldn't be neglected.

I have removed responses from this node and added them to subnodes to satisify the node's fans.



Evan Carroll
www.EvanCarroll.com

In reply to Tabs vs Spaces lets give this a go by EvanCarroll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.