In theory, one could use tabs to indicate indentation of the block and use spaces to indicate a line continuation or to make things vertically aesthetic:

sub foo { <tab>while (<FOO>) { <tab><tab>chop; <tab><tab> /^ \s* (\w+) \s* = \s* " (.*) " $/x <tab><tab>or /^ \s* (\w+) \s* = \s* (.*) $/x <tab><tab>or die "Malformed line $. in FOO"; <tab>} }

It is unambiguous from the tabs that the first // is at the same block level as its surrounding lines. Unambigous, at least, to a machine or to somebody with visible tabs and/or spaces.

That said, I don't do this, and I've never seen anybody that did. (But I use pico and I don't have many friends. (Draw your own conclusions there.)) And if not everybody follows the convention, then you can't rely on the system.

FWIW, I have had to work with code indented twice around the screen before the inking characters, and had I been using an editor that would shorten tabs, I'd have still ended up with one in ten lines having 160 leading spaces. While K&R and Linus probably overgeneralized with the three-indent rule, I've yet to see any code whose biggest flaw was the characters it used for spacing.

While indent and perltidy are marvelous tools, we also need "unindent" and "perluntidy". Each would take (1) the original source before you got stuck with it, (2) the tidied source, and (3) the tidied source plus your fixes, and spit out (4) the fixed source in the style of the original.


In reply to Re: Re: The classical TAB issue by TilRMan
in thread The classical TAB issue by Lorand

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.