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

> multiple-return is pretty much unique to Lua (vs. returning a tuple)

Multiple returns are from Common Lisp (I don't know if the history goes back further though), and they aren't tuples. They're the return-position analogue of what are default arguments in argument-position; like default args allow callers to ignore arguments they don't care about, multiple returns allow callers to ignore the return values they don't care about. You can add a secondary return value to a function without breaking existing callers, just like you can add a new default arg.




Barbra Liskov’s CLU language had multiple returns in 1973, ten years before Common Lisp. I was a student of hers back then.

I’m pretty sure I saw multiple returns used in pseudo-code on a class handout the semester before I started working on CLU. The class was “Structure and Interpretation of Computer Programs” that would lead to the writing of SICP.


You're right, CLU is actually where Lua took them from. From "The Evolution of Lua"

> From CLU we took multiple assignment and multiple returns from function calls. We regarded multiple returns as a simpler alternative to reference parameters used in Pascal and Modula and to in-out parameters used in Ada; we also wanted to avoid explicit pointers (used in C).


Looks like POP-2 from 1968 also had multiple return values.

Lisp Machine Lisp is claimed to be the first Lisp to have that feature (end 70s), from where Common Lisp got it.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: