3 ms·
I agree that the latter version is too verbose, but if the alternative is this: err := h(cond(x) ? f(x) : g(x)) ... then I'd much rather stick with the verb
by Mawr 5y ago
I agree that the latter version is too verbose, but if the alternative is this:
err := h(cond(x) ? f(x) : g(x))
... then I'd much rather stick with the verbosity. There's way too much going on in a single line here.
I'd rather have if statements be expressions, with gofmt-enforced line breaks:
err := h(
if cond(x) {
f(x)
} else {
g(x)
},
)
No unnecessary temp variables and no stuffing everything into one line.
- collaborative 5y agoI love stuffing things into one-liners. Not hard to see what is happening if you understand it enough Reason is I prefer to move my eye balls than scroll the screen. Too many lines and you forget what preceded what you're seeing or have to keep scrolling to make sense of everything