Live data from Hacker News

Interesting things about the Lua interpreter (2020)

thesephist.com

41–44 of 44 posts

Re: Interesting things about the Lua interpreter (2020)

#41

I'd love to see upvalues diagrammed as they are represented in memory. It sounds like the stack is perhaps a Stack , where each Frame contains the locals for that stack frame; then a coroutine just needs to keep a pointer to the stack frame it is closing over. (And then, Frame does too, recursively, incase there is more than one scope being closed over.) This would be extremely similar to … most any other language ……

> 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…

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.

Re: Interesting things about the Lua interpreter (2020)

#42

I love that they went from a single-pass interpreter to a byte-code virtual machine, and now like PHP, also has direct access to C & system libraries! Lua has come a long way since it's advent.

The paper and article are about lua 5.0 which came out in 2003. I don't believe it had any prominence at all before that so this stuff has "always" been there in lua unless you were in the CS dept at puc-rio in the 90s.

I think Lua started catching on outside of PUC-Rio before 5.0 in 2003. Remember, LucasArts used it in Grim Fandango, and that became widely known in the game industry in 1999 or 2000. My own first exposure to Lua was in a Linux distro package repository sometime in 2000. That's why, when I was looking for a lightweight scripting language implementation in late 2004, I remembered Lua. So yes, my actual first exposure to the Lua language was Lua 5.0, but I consider myself a relatively late adopter.

Re: Interesting things about the Lua interpreter (2020)

#43
post #41

Earlier quoted context omitted.

> 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…

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.

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.

Re: Interesting things about the Lua interpreter (2020)

#44
post #41

Earlier quoted context omitted.

> 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…

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).

Post reply on HN