lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto writes:

> Proper tail recursion is not difficult to implement, but also it is
> not as simple as in Scheme. In Lua, functions may be Lua functions
> or C functions: C functions cannot be called using proper tail
> recursion, and only at runtime we know whether a tail call calls a
> Lua function.  (Also we must take care of 'function' tag methods.)

I would be interested in learning more about the issues involved and
am will to help if I can.  I looked at the source and found little
documentation in the sources.  Is there a design document describing
the Lua implementation?  Is there at least a document that describes
the semantics of each bytecode?

> Moreover, proper tail recursion spoils debug information, does it
> not?  (Maybe that is not a too high price to pay...).

When using Scheme, I found it natural not to expect to see stack
frames that could not effect the future of the computations, so I
never worried about this.

John