C++ Templates as Partial Evaluation

13 years 6 months ago
C++ Templates as Partial Evaluation
This paper explores the relationship between C++ templates and partial evaluation. Templates were designed to support generic programming but unintentionally provided the ability to write code generators and perform static computations. These features are accidental, and as a result their syntax and semantics are awkward. Despite being unwieldy, these techniques have become somewhat popular because they partially solve an important problem in scienti c computing how to provide libraries of domain-speci c ions without performance loss. It turns out that the C++ template mechanism is really partial evaluation in disguise: C++ may be regarded as a two-level language in which types are rst-class values and template instantiation resembles o ine partial evaluation. That C++ templates have proven so useful underscores the potential importance of partial evaluation as a language feature.
Todd L. Veldhuizen
Added 04 Aug 2010
Updated 04 Aug 2010
Type Conference
Year 1999
Where PEPM
Authors Todd L. Veldhuizen
Comments (0)