Abstract
Staging is a programming technique for dividing the computation in order to exploit the early availability of some arguments. In the early stages the program uses the available arguments to generate, at run time, the code for the late stages. A type system for staging should ensure that only well-typed expressions are generated, and that only expressions with no free variables are permitted for evaluation. In this paper, we present a calculus for staged computation in which code from the late stages is composed by splicing smaller code fragments into a larger context, possibly incurring capture of free variables. The type system ensures safety by tracking the names of free variables for each code fragment. The type system is based on the necessity operator □ from constructive modal logic, which we index with a set of names C. Our type □CA classifies expressions of type A that belong to the late stage, and whose free names are in the set C. © 2005 Cambridge University Press.
Cite
CITATION STYLE
Nanevski, A., & Pfenning, F. (2005). Staged computation with names and necessity. Journal of Functional Programming, 15(6), 893–939. https://doi.org/10.1017/S095679680500568X
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.