4 ms·
Thanks for your response. > When not all call sites can be found (for example in compilation of separate files), it is still possible to create two versions of
by twtw 8y ago
Thanks for your response.
> When not all call sites can be found (for example in compilation of separate files), it is still possible to create two versions of (ADDER x), one that uses lambda lifting and one that does not.
I'm starting to suspect we interpreted the original comment ("getting rid of closures") differently. I understood that as completely eliminating all closures from a source program via lambda lifting, such that an implementation needs no alternative method of implementing closures. It sounds like maybe you understood that as getting rid of a specific occurrence of a closure in certain special cases, more like an optimization. Does that sound accurate?
I can imagine several scenarios when it seems like you could have have a closure that could not be eliminated via lambda lifting (like maybe if the identity of the returned function is nondeterministic, or where the closure includes some mutable state called from multiple sites).
Put another way, does your implementation have lambda lifting in addition to a runtime implementation of closures, or instead of one. Can lambda lifting completely obviate the need for passing around an environment in all cases, or just optimize it away in certain cases?
- nils-m-holm 8y agoYes, I view lambda lifting as an optimization and my implementations provide both, closures and combinators. I guess that a global program transformation could eliminate all closures from a purely functional program, but I'm not attempting to do this -- mostly because lambda lifting cannot be applied to many closures that mutate free variables. For instance, the lambda functions created in the expansion of Scheme's LETREC cannot be lambda-lifted.
- twtw 8y agoAwesome, that makes a lot of sense. Thanks for helping me understand these things better.