Staged computation with names and necessity

  • Authors:
  • Aleksandar Nanevski;Frank Pfenning

  • Affiliations:
  • Carnegie Mellon University, Pittsburgh, PA 15213, USA (email: aleks@cs.cmu.edu, fp@cs.cmu.edu);Carnegie Mellon University, Pittsburgh, PA 15213, USA (email: aleks@cs.cmu.edu, fp@cs.cmu.edu)

  • Venue:
  • Journal of Functional Programming
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

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.