Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

Re-opening Closures Andrew W. Appel

Summary: Re-opening Closures
Andrew W. Appel
Department of Computer Science
Princeton University
Princeton, NJ 08544
There are two different commonly-used evaluation methods for functional
languages: normal-order graph reduction, and call-by-value execution of closure code.
The former is usually more expensive per operation, but has the capability of partially
evaluating functions before they are applied. The latter method usually leads to faster
execution -- and is thus used in most compilers -- but can't ``optimize'' functions
before they are called.
The different advantages of the two methods are particularly visible in the evalua-
tion of higher-order functions. After a higher-order function is applied to one argument,
the graph-reducer can begin evaluation, while the closure-code evaluator must wait until
all arguments are present. On the other hand, because the closure-code evaluator exe-
cutes the native code of the computer, it usually outperforms the graph-reducer.
The two evaluation algorithms can be combined to take advantage of the best
behaviors of both. Fragments from programs that are already executing can be extracted,
reduced, and re-compiled. This is done with an operator, reduce, that is semantically


Source: Appel, Andrew W. - Department of Computer Science, Princeton University


Collections: Computer Technologies and Information Sciences