Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: The One True Style of indentation:

by Dog and Pony (Priest)
on Apr 14, 2002 at 11:17 UTC ( #158917=note: print w/ replies, xml ) Need Help??


in reply to The One True Style of indentation:

I usually use tabs, and each tabstop at 4 spaces. This seems to work just about everywhere, and it is very easy to read. If my code lines would go too far to the right with 4, I probably have too long code lines and/or too deep nesting anyways.

Posting code to this site however, I've sometimes converted the tabs into two-space indents instead of four (we all can agree that conversion is almost a must here in any case?), because with the fonts here, it is still readable with two. Same with emacs, that big standard font makes two-indent readable. Until I try to open the same source in any other editor, then I have to increase the indent. Well, of course not *any*, but any of the others I usually have access to or use.

My goal is of course that it should be easily read anywhere, by anyone. But the two-space indenters usually say the same, so I guess we are stuck. :) It is almost as religious an issue as best editor or where to put the braces...


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.


Comment on Re: The One True Style of indentation:
Re: The One True Style of indentation:
by Tardis (Pilgrim) on Apr 14, 2002 at 12:41 UTC
    It is almost as religious an issue as best editor or where to put the braces...
    Brace placement - there is the right way, and then there are the other wrong ways.

    :-)

    Best editor is of course emacs, since I don't have to care about indenting, I just press tab and emacs moves the cursor to the right place, no matter where on the line the cursor is.

      Absolutely. I use
      function(arguments) { if (condition) { ... } else { ... } }
      Brace placement is far more important to me than indentation, though I use tabs for that with four spaces as my second choice, if, for instance, the tab key breaks or starts printing Ős. That's never happened, but if it did I'd use four spaces and buy a new keyboard. But something like
      function(arguments) { if (condition) { ... } else { ... } }
      is unreadable.
        Absolutely. If you want to do it right, it would have to look like this:
        function(arguments) { if (condition) { ... } else { ... } }

        Makeshifts last the longest.

Re: Re: The One True Style of indentation:
by bassplayer (Monsignor) on Apr 17, 2002 at 00:15 UTC
    I also prefer tabs with 4 space tabstop. With tabs, the next programmer to use the code can set the indents to his/her preferred spacing, using tabstop (or equivalent setting). Tabs offer more flexibility that way.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://158917]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-09-01 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (299 votes), past polls