Tradeoffs in metaprogramming

  • Authors:
  • Todd L. Veldhuizen

  • Affiliations:
  • Indiana University Bloomington, Bloomington, IN

  • Venue:
  • Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

The design of metaprogramming languages requires appreciation of the tradeoffs that exist between important language characteristics such as safety properties, expressive power, and succinctness. Unfortunately, such tradeoffs are little understood, a situation we try to correct by embarking on a study of metaprogramming language tradeoffs using tools from computability theory. Safety properties of metaprograms are in general undecidable; for example, the property that a metaprogram always halts and produces a type-correct instance is Π02-complete. Although such safety properties are undecidable, they may sometimes be captured by a restricted language, a notion we adapt from complexity theory. We give some sufficient conditions and negative results on when languages capturing properties can exist: there can be no languages capturing total correctness for metaprograms, and no 'functional' safety properties above Σ03 can be captured. We prove that translating a metaprogram from a general-purpose to a restricted metaprogramming language capturing a property is tantamount to proving that property for the metaprogram.