Thunks and the -Calculus (Extended Version)
Plotkin, in his seminal article Call-by-name, call-by-value and the -calculus, formalized evaluation strategies and simulations using operational semantics and continuations. In particular, he showed how call-by-name evaluation could be simulated under call-by-value evaluation and vice versa. Since Algol 60, however, call-by-name is both implemented and simulated with thunks rather than with continuations. We recast this folk theorem in Plotkin's setting, and show that thunks, even though they are simpler than continuations, are sufficient for establishing all the correctness properties of Plotkin's call-by-name simulation.
Furthermore, we establish a new relationship between Plotkin's two continuation-based simulations and , by deriving as the composition of our thunk-based simulation and of -- an extension of handling thunks. Almost all of the correctness properties of follow from the properties of and . This simplifies reasoning about call-by-name continuation-passing style.
We also give several applications involving factoring continuation-based transformations using thunks