Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: numbers with chainable comparisons

by Courage (Parson)
on Jan 19, 2006 at 18:19 UTC ( #524310=note: print w/ replies, xml ) Need Help??


in reply to Re: numbers with chainable comparisons
in thread numbers with chainable comparisons

$x < $y and $y <= $z is good but then you'll quickly need to write very differently when instead of $y there will be complex expression with may be side effects.
... unfortunately...

Best regards,
Courage, the Cowardly Dog


Comment on Re^2: numbers with chainable comparisons
Download Code
Re^3: numbers with chainable comparisons
by Anonymous Monk on Jan 19, 2006 at 22:12 UTC
    I would never put a complex expression with side effects inside a comparison anyway. I prefer simple code; if I have to have a complex expression, I'd evaluate it separately, then go on to do the comparison.

    I hate those map-grep-map-fold-spindle-mutilate commands where everything is done in a single, incomprehensible line riddled with nested ternary operators and uncommented regexps. When the code breaks, there's no intermediate stages to check for correctness; there's just a mess of nested context and conditional return values that are supposed to work, but somehow don't.

    Yes, I'm bitter. My boss got fired, and I have to maintain the code he left behind, most of it undocumented, and often attempting to solve problems we don't actually have, and may never encounter. Sometimes code that is probably never hit looks buggy; but it's hard to tell because of all the state and flags flying around.

    It's done nothing to lessen my hatred for complex expressions where simple ones do the job. If you really need complexity, fine. If you don't, just do what's simple and obvious; don't waste someone else's time fixing your mistakes just because you thought it would be fun to be clever. --
    Ytrew

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2014-11-27 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (185 votes), past polls