Futamura Projections
A particularly interesting example of this, first described in the 1970s by Yoshihiko Futamura, is when prog is an interpreter for a programming language.
If Istatic is source code designed to run inside said interpreter, then partial evaluation of the interpreter with respect to this data/program produces prog*, a version of the interpreter that only runs that source code, is written in the implementation language of the interpreter, does not require the source code to be resupplied, and runs faster than the original combination of the interpreter and the source. In this case prog* is effectively a compiled version of Istatic.
This technique is known as the first Futamura projection, of which there are three:
- Specializing an interpreter for given source code, yielding an executable
- Specializing the specializer for the interpreter (as applied in #1), yielding a compiler
- Specializing the specializer for itself (as applied in #2), yielding a tool that can convert any interpreter to an equivalent compiler
Read more about this topic: Partial Evaluation
Famous quotes containing the word projections:
“Predictions of the future are never anything but projections of present automatic processes and procedures, that is, of occurrences that are likely to come to pass if men do not act and if nothing unexpected happens; every action, for better or worse, and every accident necessarily destroys the whole pattern in whose frame the prediction moves and where it finds its evidence.”
—Hannah Arendt (19061975)