[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Recursion
- From: Gavin Wraith <gavin@...>
- Date: Fri, 24 Apr 2020 09:20:01 +0100
Many thanks for the words of wisdom on mutual recursion.
Perhaps I should explain the background of my query.
The semantics of BBC BASIC are very different from
Lua's. The BASIC interpreter keeps a linked list of
function descriptors. As it scans the program source
if it finds a function call it looks to see if it
can find the function's descriptor in the list. If
it cannot, it scans the rest of the program source for
the function's definition, and, if it finds it, adds
the new function descriptor to the list, or raises an
error if it cannot - doing all this before resuming
interpretation. In other words, it is as eager as it can
be to resolve function calls, and that means that
recursion is straightforward.
An old friend of mine, sadly now ill, spent years
writing a much-praised piece of software in BBC
BASIC, in a very modular fashion. The differences in
semantics between Lua and BBC BASIC make rewriting
the software by no means straightforward.
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org