lua-users home
lua-l archive

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

On Tue, Jun 19, 2012 at 6:26 PM, Paul K <> wrote:
> Hi Cosmin,
> Yes, that's my case.
> Does anyone know if this is a known limitation that is not going to be fixed?
> Paul.
> On Tue, Jun 19, 2012 at 10:42 AM, Cosmin Apreutesei
> <> wrote:
>> maybe this answer could help?

I don't believe that this is a bug. My understanding is that:

A tail call is much like a goto, in that if Lua sees that there is
nothing left to do, it jumps to the new function without using setting
a spot in the stack to return to after the flow is complete.

Therefore, and I'm a bit beyond my first hand knowledge and only into
what I've read to understand: "f" points to a function, which as a
tail call, Lua jumps to, but that it was "f"  from your function's
environment and not some other variable pointing to that function in
some other environment is lost in the magic of giving you a stack-less
method to call another function from your function's return value.
Your environment is gone, along with your "f".

Hence, no name and not a bug.

Someone who knows better than I: Did I get that right?

Paul: did that make sense?

Best Regards,

Andrew Starks