lua-users home
lua-l archive

Re: Proper Tail Calls Lua 5.2

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


On 13/02/2016 02:38, Derek Bailey wrote:
[snip]
Would the following statements fit that form or not?
[snip]
 return func(tbl[nextKey]), _map(func, nextKey, tbl)
According to manual [1], no, this is not a case of tail call. Quoting that part (emphasis mine):
<quote>
A call of the form return functioncall is called a tail call.
[snip]
Note that **a tail call only happens with a particular syntax**, where the return has **one single function call** as argument;
[snip]
</quote>
And this is confirmed looking at the VM disassembled code, as Dirk showed in another message.
Cheers!
-- Lorenzo
[1] http://www.lua.org/manual/5.3/manual.html#3.4.10

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