Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: ?: = Obfuscation?

by throop (Chaplain)
on Dec 01, 2006 at 22:10 UTC ( #587313=note: print w/ replies, xml ) Need Help??


in reply to Re^2: ?: = Obfuscation?
in thread ?: = Obfuscation?

I like ?: when the args are short.

I spent years as a LISP programmer. A programmer who has memorized the precedence table will write code that's understandable by others who have memorized the precedence table. Use parenthesis liberally.

$longways = $widthIsLonger ? $width || 1 : $height || 1;
may work and is terse, but
$longways = $widthIsLonger ? ($width || 1) : ($height || 1);
reads better to me.

It's mostly the case that if I'm using an operator within the scope of ?: I'll parenthesize.


Comment on Re^3: ?: = Obfuscation?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2015-07-03 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls