in reply to Re^2: ?: = Obfuscation?
in thread ?: = Obfuscation?
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.
may work and is terse, but$longways = $widthIsLonger ? $width || 1 : $height || 1;
reads better to me.$longways = $widthIsLonger ? ($width || 1) : ($height || 1);
It's mostly the case that if I'm using an operator within the scope of ?: I'll parenthesize.
|
---|