Tue Aug 2 16:41:01 CEST 2011

Closure Conversion / Lambda Lifting

A brief rehash.  According to [1] both mean the same.  The basic
principle is to close a lambda that captures a lexical variable by
adding that variable as a formal parameter, and then supplying this
parameter at all the call sites.

The "lifting" refers to bringing the lambda into a more general
context, i.e. the toplevel.

The point is to _avoid_ having to create closures.  The catch is that
you need to know all the call sites of the function to provide the
extra arguments.

When a function escapes, it is still necessary to represent it as a
closure, which is a (toplevel) function together with an environment
that defines the captures variables.

How's this relative for the DSP language?  The DSP lang is used to
specify programs that process data, i.e. they are in some sense "fully
bound" meaning there will not be any escaping lambdas.  However,
lambdas might still be useful because they allow for instantiation of
iteration patterns through higher order functions.

[1] http://en.wikipedia.org/wiki/Lambda_lifting