|recursive nested functions email@example.com (nojb) (2010-06-25)|
|Re: recursive nested functions cfc@shell01.TheWorld.com (Chris F Clark) (2010-06-27)|
|Re: recursive nested functions firstname.lastname@example.org (Gene) (2010-06-27)|
|Re: recursive nested functions email@example.com (BGB / cr88192) (2010-06-28)|
|From:||"BGB / cr88192" <firstname.lastname@example.org>|
|Date:||Mon, 28 Jun 2010 17:17:24 -0700|
|Posted-Date:||29 Jun 2010 11:11:15 EDT|
"Gene" <email@example.com> wrote in message
> On Jun 25, 1:30 pm, nojb <n...@uchicago.edu> wrote:
> Check the literature on lambda lifting. Although the theory was
> worked out for functional languages, it works for imperative ones,
> too. You need to pass references around rather than values. Function
> pointers generally need to be "fat" i.e. to include references to all
> bound variables.
one doesn't necessarily need fat pointers.
for example, one typical architectures, such as x86, one can instead pass
around a function pointer to an in-memory object, which when called may in
turn call the true function passing the captured variables in addition to
this has the advantage that it can remain C ABI compatible.
> I'm not sure of the problem you are describing. It sounds like you
> are confusing dynamic and static scopes. Lambda lifting makes sense
> only in the context of static scopes. A function F that declares a
> variable X will still declare X in the lifted code. Calls to a
> function G originally nested within F will pass X (or a reference to
> it), and G will accept the reference. If G calls itself recursively,
> it passes the same reference to X it received. Same if it calls a
> nested function H that ultimately calls G.
yeah, I didn't respond originally as I couldn't make much sense of what was
I thought mayve something different was being asked, and so left it to
others to try to respond.
Return to the
Search the comp.compilers archives again.