Re:Clear is better than clever [pdf]
by coldtea on Monday May 06, 2019 @09:33AM
(#19839222)
>It's interesting that the comparator function is one of the examples, because that's something which shows how people often confuse verbose with clear; I think it's best written in a single line:
return a < b ? -1 : a > b ? 1 : 0;
That's nowhere near clear. I frequently use a single level ternary, but this is an abomination and very easy to make a subtle error in.
That's nowhere near clear. I frequently use a single level ternary, but this is an abomination and very easy to make a subtle error in.