Tradeoffs in metaprogramming

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.

[1]  James S. Royer,et al.  Subrecursive Programming Systems , 1994, Progress in Theoretical Computer Science.

[2]  Neil D. Jones,et al.  Computability and complexity - from a programming perspective , 1997, Foundations of computing series.

[3]  Manuel Blum On the Size of Machines , 1967, Inf. Control..

[4]  Neil D. Jones,et al.  LOGSPACE and PTIME Characterized by Programming Languages , 1999, Theor. Comput. Sci..

[5]  Leonid Libkin,et al.  Elements Of Finite Model Theory (Texts in Theoretical Computer Science. An Eatcs Series) , 2004 .

[6]  Robert I. Soare,et al.  Computability and Recursion , 1996, Bulletin of Symbolic Logic.

[7]  H. Rice Classes of recursively enumerable sets and their decision problems , 1953 .

[8]  Tim Sheard,et al.  Type Safe Meta-Programming , 1994 .

[9]  Ben Wegbreit,et al.  The treatment of data types in EL1 , 1974, CACM.

[10]  Abhi Shelat,et al.  Approximating the smallest grammar: Kolmogorov complexity in natural models , 2002, STOC '02.

[11]  Benjamin M. Brosgol An implementation of ECL data types , 1971 .

[12]  J. Case,et al.  Subrecursive Programming Systems: Complexity & Succinctness , 1994 .

[13]  Juris Hartmanis,et al.  On Gödel Speed-Up and Succinctness of Language Representations , 1983, Theor. Comput. Sci..

[14]  Todd L. Veldhuizen Software Libraries and Their Reuse: Entropy, Kolmogorov Complexity, and Zipf's Law , 2005, ArXiv.

[15]  Ming Li,et al.  An Introduction to Kolmogorov Complexity and Its Applications , 1997, Texts in Computer Science.

[16]  Walid Taha,et al.  MetaML and multi-stage programming with explicit annotations , 2000, Theor. Comput. Sci..

[17]  J. Hopcroft,et al.  Independence results in computer science , 1976, SIGA.

[18]  Dennis M. Ritchie,et al.  The complexity of loop programs , 1967, ACM National Conference.

[19]  Ben Wegbreit An overview of the ECL programming system , 1971 .

[20]  Shan Shan Huang,et al.  Statically safe program generation with safegen , 2005, GPCE'05.

[21]  Thomas R. G. Green,et al.  Cognitive dimensions of notations , 1990 .

[22]  Stephen N. Zilles,et al.  Programming with abstract data types , 1974, SIGPLAN Symposium on Very High Level Languages.

[23]  Leonid Libkin,et al.  Elements of Finite Model Theory , 2004, Texts in Theoretical Computer Science.

[24]  Harold Siegal,et al.  The use of generators in TAC , 1959, ACM '59.

[25]  Neil Immerman,et al.  Descriptive Complexity , 1999, Graduate Texts in Computer Science.

[26]  Maria Kutar,et al.  Cognitive Dimensions of Notations: Design Tools for Cognitive Technology , 2001, Cognitive Technology.

[27]  John E. Hopcroft,et al.  An n log n algorithm for minimizing states in a finite automaton , 1971 .

[28]  Robert Glück,et al.  Efficient Multi-level Generating Extensions for Program Specialization , 1995, PLILP.

[29]  S. C. Kleene,et al.  Introduction to Metamathematics , 1952 .

[30]  J. Case,et al.  Subrecursive programming systems - complexity and succinctness , 1994 .

[31]  Krzysztof Czarnecki,et al.  Generative programming - methods, tools and applications , 2000 .

[32]  Rozsa Peter Review: H. G. Rice, Classes of Recursively Enumerable Sets and their Decision Problems , 1954 .

[33]  Paul E. Ceruzzi,et al.  A history of modern computing , 1999 .

[34]  Bruno Courcelle,et al.  Recursive Applicative Program Schemes , 1991, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[35]  Glenn H. Holloway Interpreter/compiler integration in ECL , 1971 .