Meta-programming through typeful code representation
Chiyan Chen, Hongwei Xi · ACM SIGPLAN Notices · 2003
By allowing the programmer to write code that can generate code at run-time, meta-programming offers a powerful approach to program construction. For instance, meta-programming can often be employed to enhance program efficiency and facilitate the construction of generic programs. However, meta-programming, especially in an untyped setting, is notoriously error-prone. In this paper, we aim at making meta-programming less error-prone by providing a type system to facilitate the construction of correct meta-programs. We first introduce some code constructors for constructing typeful code representation in which program variables are replaced with deBruijn indices, and then formally demonstrate how such typeful code representation can be used to support meta-programming. The main contribution of the paper lies in recognition and then formalization of a novel approach to typed meta-programming that is practical, general and flexible.
Cited by 9 works. doi:10.1145/944746.944730
Authors
References
- A formulation of the simple theory of types
- Principal type-schemes for functional programs
- Efficient implementation of the smalltalk-80 system
- Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem
- Optimizing ML with run-time code generation
- Customization: optimizing compiler technology for SELF, a dynamically-typed object-oriented programming language
- Multi-stage programming with explicit annotations
- Hardware/software trade‐offs for bitmap graphics on the blit
- Higher-order abstract syntax
- Simple imperative polymorphism