15-312 Foundations of Programming Languages
Lecture 22: Call-by-Need and Futures
In this lecture first introduce call-by-need, an operational semantics
that makes a call-by-name language practical. It works by allocating a
so-called thunk on the heap containing the argument during a
function call and just passing a pointer to the thunk. When the value
of the pointer is really needed in order to make progress, the thunk
is evaluated, and the value memoized in order to avoid future evaluations.
We then discuss the future construct, where the evaluation of
its argument proceeds in parallel with the remainder of the computation.
Synchronization occurs when the value of a future is really needed, that
is, when an elimination rule is applied to it. Futures were first
developed in Multilisp, but are compatible with static typing, as we