Please remove ?:
Jarrett Billingsley
kb3ctd2 at yahoo.com
Fri Jun 2 12:27:14 PDT 2006
"Lionello Lunesu" <lio at lunesu.remove.com> wrote in message
news:e5pcja$td0$1 at digitaldaemon.com...
> Please remove ?:...
I'll agree with you to an extent, though keep in mind that I am of the
opinion that the tradeoff of a bit more space for a lot more readability is
a Good Thing (TM). ?: can be abused, certainly, but so can most of the
other language constructs. That code that you show is certainly abuse; any
code where the effect isn't immediately obvious is, in my opinion,
badly-written. I've seen conditional statements nested three deep before.
It's not a pretty thing.
I rarely use ?:, and when I do, it's always something very short and
obvious, such as
char[] name = (numApples > 1) ? "apples" : "apple";
However, there will always be programmers who _like_ to nest conditional
statements three deep, and because D is a practical language and not an
ideological language, ?: won't be going away.
More information about the Digitalmars-d
mailing list