Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The saddest part is that Go's designers decided to use MRV but pretty much just as bad tuples: as far as I can tell the only thing Go uses MRV for which tuple wouldn't be better as is post-updating named return values, and you could probably just update those via the container.

Common Lisp actually does cool things (if a bit niche) things with MRVs, they're side-channels through which you can obtain additional information if you need it e.g. every common lisp rounding functions returns rounded value... and the remainder as an extra value.

So if you call

  (let ((v (round 5 2)))
    (format t "~D" v))
you get 2, but if you

  (multiple-value-bind (q r) (round 5 2)
    (format t "~D ~D" q r))
you get 2 and 1.


You can at least in Go do this:

r, err := f()

r := f()

_, err := f()


No, you can not do the second one.

The other two are completely routine and will work just fine with lists in JS or tuples in Python or Rust (barring a few syntactic alterations).




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: