I disagree with the argument that a simple ternary could become unwieldy as 
a reason not to introduce it to a language.

People should be trusted (just as they are now with other constructs) to 
use a more suitable construct or to refactor when a given one fails to 
scale.  The fact that the Guilded Rose kata can be written with all it's 
nasty if/else nesting in Go, means regardless of whether a ternary 
expression is introduced or not, people will still write bad code.

RE the suggestion that a ternary wouldn't scale when new temperatures are 
required, use a switch.

RE the suggestion that Go already has ternary operators (with an example 
using `map`), this is far less readable than the ternary operator in most 
other languages and way less efficient.

RE the suggestion that a default case followed by an if statement can be 
used instead, I think that in the case of the ternary, the values are so 
intrinsically linked, that having a variable set across multiple lines is 
less readable.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to