[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Stack with a tail call is missing function names?
- From: Paul K <paulclinger@...>
- Date: Tue, 19 Jun 2012 17:56:21 -0700
Right; make sense. I suspected something similar as I remember that a
tail call doesn't create a separate frame on the stack (or something
along those lines), but I was surprised that the function name has
disappeared. Thanks for the details.
On Tue, Jun 19, 2012 at 5:03 PM, Andrew Starks <email@example.com> wrote:
> On Tue, Jun 19, 2012 at 6:26 PM, Paul K <firstname.lastname@example.org> wrote:
>> Hi Cosmin,
>> Yes, that's my case.
>> Does anyone know if this is a known limitation that is not going to be fixed?
>> On Tue, Jun 19, 2012 at 10:42 AM, Cosmin Apreutesei
>> <email@example.com> 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