lua-users home
lua-l archive

Re: Stack traces with tail calls: disabling tail recursion?

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


2014年02月25日 11:51 GMT+02:00 Ico <lua@zevv.nl>:
> Are there other people out there who are having issues with tail call stack
> traces, and if so, how dow you handle this in real life debugging?
You could avoid tail calls until the program is debugged.
A tail call arises in this situation:
 return func(x,y,z)
 end
If you don't know how many values func will return, you're stuck with
the tail call.
Otherwise you can do:
 local a,b,c = func(x,y,z)
 return a,b,c
 end
If there is either exactly one return value or it does not matter
to replace return nothing by return nil, it's easier:
 return (func(x,y,z))
 end

AltStyle によって変換されたページ (->オリジナル) /