[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Abolishing tail call levels in 5.2 (Was Re: debug.getlocal losing information)
- From: GrayFace <sergroj@...>
- Date: Sun, 11 Jul 2010 06:35:46 +0700
On 08.07.2010 4:17, Roberto Ierusalimschy wrote:
What are the drawbacks of old behavior from the practical point of
view? IMO, the more tail call is different from normal call, the
more confusion it makes.
This has been extensively discussed in the past. (Of course in the
reverse; list member complained about the old behavior and we defended
it.) Seach the Lua list for "tail calls" (or tail calls debug).
In posts I found the main point against reporting tail calls was about
stack machines. If a stack machine relies on tail calls, it would
generate lots of tail calls that will pollute the traceback.
I think it can be dealt with by a simple debug.traceback modification.
It can be made to report one "(15 tail calls): ?" line instead of 15
"(tail call): ?" lines if there were 15 tail calls. This would look
pretty, IMO.
The number of tail calls before a stack level can also be exposed to
debug interface, so that it can skip the tail calls instead of iterating
through them.
Here are the results of search - some posts on the issue I found most
interesting:
Discussion of whether tail calls are good or not in a regular traceback:
http://lua-users.org/lists/lua-l/2005-08/msg00163.html
An argument about easier debugging with 5.1 behavior:
http://lua-users.org/lists/lua-l/2003-09/msg00330.html
Non-tailcallable closures proposal:
http://lua-users.org/lists/lua-l/2005-08/msg00159.html
(this one could solve the thread starter's problem with debug.getlocal use)
In essence, tail calls *are* different from normal calls, no matter
what the debug interface tells you. So, the question is not about how
different tail calls are from normal calls, but how much the debug
interface tries to hide these differences from you.
It does the job well. In 5.1 only the debug interface shows that
difference. After the change it would also affect 'error' function from
the usual interface.
I can hardly imagine tail call levels being a source of confusion. I'm
sure confusion would grow significantly after the removal of tail call
levels. The same syntax of normal calls and tail calls suggests that
they are mostly similar and that's the source of confusion.
--
___________________________________________
Best regards,
Sergey Rozhenkomailto:sergroj@mail.ru