On that same vein, if a ternary operation is going to throw someone for a loop, I've got some bad news about their career in programming.
Because when something is expressed in 10 lines explicitly, generally you can simply skim over the code to get an idea of what's going on without having to go into the details.
"Smart and clever" code, like using nested ternaries, demands you to focus and try to figure out what is going on.
Which is why important details get missed when reviewing verbose code.
>On that same vein, if a ternary operation is going to throw someone for a loop, I've got some bad news about their career in programming.
You're right about someone having and issue if they can't understand this on it's own. What was the last application you worked in where that single line is all you had to understand to accomplish whatever task you were working on?
The bigger constructs expressed in functions, classes, etc, are where the attention should really be.
The smaller ideas expressed in single lines of code are, should be, insignificant in terms of cognitive load.
There are some exceptions to this, in particular very high performant code. We all know that "premature optimization...".
It's a question of trade offs but you cant entirely ignore one or the other
You don't read ten lines, you decode them. If it's ten simple lines, decoding them is easy. If it's a nested ternary, it's a lot more cognitive load - unless you're used to nested ternary expressions.
However, I'd say it's a fair assertion to make that most people aren't used to reading nested ternaries.
And I think that's what Go (and this presentation) is about; you shouldn't need to get used to a certain code style to be able to decode it. You should be able to open up a file and not be surprised. If I were to come across a nested ternary, my first reaction is a raised eyebrow and a "wtf?". The wtfs / hour is one of the metrics that Go language is based on.