Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Problem in this thread is that the OP is effectively asking multiple questions:
  1. how should this be best written
  2. how should my editor do it
  3. what's the bug in my editor
  1. They way I write it of course!
  2. The way I would write it if I were taking appropriate care
  3. Is it that it is emacs?

The are many very bad indentation and white space usage styles in use. Aside from a desire for consistency and style informed by "that is the way we always do it", I don't think many people think very much about their code writing style. My own style decisions, which I have thought about, are driven by laziness. I use white space, to the extent reasonably possible, consistently with the conventional usage in (English) written prose. That way I already have a parsing tool (my brain) that knows how to break stuff up without needing different settings packages for prose and code.

Other style decisions are made based on intelligibility, such as keeping lines short with the important stuff toward the front, minimizing nesting, keeping functions reasonably short, and so on. Look at pretty much any of my code on PerlMonks to see how that looks. Note though that my block delimiting brace usage for Perl is K&R which I avoid in other languages (I prefer Whitesmiths).

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

In reply to Re^5: How would you indent this? by GrandFather
in thread How would you indent this? by no longer just digit

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found