in reply to Ternary operators: a hinderance, not a help
I talked with a couple of colleagues about this, and found that opinion seems to be divided one way or the other: either you love boolean ? value_if_true : value_if_false, or you hate it.
I think it's a bad idea to love an operator. They always end up leaving you for a younger and better looking programmer ;)
Seriously though, loving or hating an operator isn't a good idea. Most of the constructs a programming language like Perl offers you can be abused to produce nearly unreadable code (see Obfuscation). It's up to the programmer to write maintainable code, and _sometimes_ the ternary operator can make your code more readable.
|