David Vallner wrote: > Here, have a cookie. A Cookie of Clarity. It has extra doses of golf > urge repellent. > > Usually, the problem is the "clever" solution was stupid since the > start. I see nothing clever about just randomly stuffing some logic into > as few characters as possible - (ab)using the syntax flexibility makes > sense when you can achieve let's say a reordering of the terms that's > more natural (not necessarily quick) to read than the more common would > be. That example line of code just requires me to keep the whole ternary > conditional operator in my head as I try to mentally evaluate the > condition. > > Ternary operators are inherently evil whenever nested, although a bit > more terse in the good term when used as a single expression. Putting > the "else" result on a newline and indenting the ? with the : considered > sexy, I find it very easy to visually separate the condition and the > different results then using the quadrants split up by the operator. I'm not a big fan of nested conditionals -- there's usually an elegant refactoring that can be done when you have them. In fact, I'm not a big fan of nested anything. :)