- Quines (3)
- Conferences (4)
- Generative (8)
- Compilers (203)
- Intentional (11)
- Metaobject Protocols (4)
- Language Oriented (19)
- Source Code Generators (17)
Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that is otherwise done at run time. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually.
The language in which the metaprogram is written is called the metalanguage. The language of the programs that are manipulated is called the object language. The ability of a programming language to be its own metalanguage is called reflection or reflexivity.
Reflection is a valuable language feature to facilitate metaprogramming. Having the programming language itself as a first-class data type (as in Lisp or Rebol) is also very useful. Generic programming invokes a metaprogramming facility within a language, in those languages supporting it.
Metaprogramming usually works through one of two ways. The first way is to expose the internals of the run-time engine to the programming code through application programming interfaces (APIs). The second approach is dynamic execution of string expressions that contain programming commands. Thus, "programs can write programs". Although both approaches can be used, most languages tend to lean toward one or the other.
Last update: 2008-05-05 14:47:20 Metaprogramming | Copyright 2008 HubHip.com>