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

> So no function calls?

No recursive ones. If you forbid (direct or indirect) recursion, then a function's local variables can all be static rather than stack-allocated. Similarly, each function could have a hidden, static "return address" variable (since all parameters are static, it's really just a hidden parameter) that is set behind the scenes when a procedure is invoked and jumped to when it exits.

edit: I was just guessing how you'd do return addresses, but it looks like that is how they used to work. From Wikipedia: "Machines before the mid 1960s—such as the UNIVAC I, the PDP-1, and the IBM 1130—typically use a calling convention which saved the instruction counter in the first memory location of the called subroutine. This allows arbitrarily deep levels of subroutine nesting, but does not support recursive subroutines."

Ancient Fortran also didn't support recursive procedures, and they were only sneaked into Algol 60: https://vanemden.wordpress.com/2014/06/18/how-recursion-got-...



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

Search: