Skip to content
EntityQ661075· pop 31· linked from 281 articles

metaprogramming

Sign in to save

Metaprogramming is a computer programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyse, or transform other programs, and even modify itself, while running. In some cases, this allows programmers to minimize the number of lines of code to express a solution, in turn reducing development time. It also allows programs more flexibility to efficiently handle new situations with no recompiling.

Wikidata facts

Show 1 more fact
Sources (3)

via Wikidata · CC0

~8 min read

Article

16 sections
Contents
  • Approaches
  • Usages
  • Code generation
  • Code instrumentation
  • Challenges
  • Uses in programming languages
  • Macro systems
  • Macro assemblers
  • Metaclasses
  • Template metaprogramming
  • Staged metaprogramming
  • Dependent types
  • Implementations
  • See also
  • References
  • External links

Metaprogramming is a computer programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyse, or transform other programs, and even modify itself, while running. In some cases, this allows programmers to minimize the number of lines of code to express a solution, in turn reducing development time. It also allows programs more flexibility to efficiently handle new situations with no recompiling.

Metaprogramming can be used to move computations from runtime to compile time, to generate code using compile time computations, and to enable self-modifying code. The ability of a programming language to be its own metalanguage allows reflective programming, and is termed reflection. Reflection is a valuable language feature to facilitate metaprogramming.

Connections

Categories