Computer Science Department
School of Computer Science, Carnegie Mellon University


Meta-Programming with Names and Necessity

Aleksandar Nanevski

April 2002

This report was significantly revised in November 2002
and is now superceded by CMU-CS-02-123R.
Both versions are referenced below.

Keywords: Meta-programming, modal logic, nominal logic, intensional code analysis, staged computation, run-time code generation, symbolic computation

Meta-programming languages provide infrastructure to generate and execute object programs at run-time. In a typed setting, they contain a modal type constructor which classifies object code. These code types generally come in two flavors: closed and open. Closed code expressions can be invoked at run-time, but the computations over them are more rigid, and typically produce less efficient residual object programs. Open code provides better inlining and partial evaluation of object programs, but once constructed, expressions of this type cannot be evaluated.

Recent work in this area has focused on combining the two notions into a sound system. We present a novel way to achieve this. It is based on adding the notion of names from the work on Nominal Logic and FreshML to the LambdaBox-calculus of proof terms for the necessity fragment of modal logic S4. The resulting language provides a more fine-grained control over free variables of object programs when compared to the existing languages for meta-programming.

In addition, this approach lends itself well to addition of intensional code analysis, i.e., capability of meta programs to inspect and destruct object programs at run-time in a type-safe manner, which we also undertake.

55 pages

Return to: SCS Technical Report Collection
School of Computer Science homepage

This page maintained by