Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
That's fine if you're golfing.

I tend to be a bit more explicit in code that I'm leaving around for someone else to read. That last statement has about six semantic steps that partially nest, partially flow right to left, and partially flow left to right, without the help of denotational punctuation to help me "change gears".

It's also riddled with booby traps for the maintainer. The parens on output are mandatory, or else the redo would trigger before the function is called. If the expression for the test gets more complicated, or wants to be called only once, there's a bit of gyrating to do.

I figure anything that takes me more than a dozen seconds to parse needs to be broken up for production code. My personal rule.

See, if you were just going for compact, I'd slide that even further to:

output("Sorry, invalid option\n\n") until ask('database','Database type?', 'mysql'), grep getConf('databasetype') eq $_, @databases;
This gets rid of the naked block entirely.

But again, I would not use this in production code. This is cute to impress your friends, especially your Lisp-hacking friends. But it really aggravates the maintainer who has to try to grok that at 3am when the production web site crashes.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


In reply to •Re: Re^2: On goto by merlyn
in thread On goto by zachlipton

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 avoiding work at the Monastery: (2)
As of 2024-04-20 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found