Hacker News new | past | comments | ask | show | jobs | submit login

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.



I 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




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: