Examples of using Metaprogramming in English and their translations into Serbian
{-}
-
Colloquial
-
Ecclesiastic
-
Computer
-
Latin
-
Cyrillic
Reflection is also a key strategy for metaprogramming.
Template metaprogramming was, in a sense, discovered accidentally.
The act of working with metalanguages in programming is known as metaprogramming.
JetBrains MPS, a metaprogramming system from JetBrains.
Reflection is a valuable language feature to facilitate metaprogramming.
Generic programming invokes a metaprogramming facility within a language, in those languages supporting it.
This allows easy writing of programs which manipulate other programs(metaprogramming).
Metaprogramming is the writing of computer programs with the ability to treat programs as their data.
It has been described as a compile-time variant of the strategy pattern, andhas connections with C++ template metaprogramming.
Thus, template metaprogramming can accomplish truly generic code, facilitating code minimization and better maintainability.
Examples of modern-day programming languages which commonly find use in metaprogramming include Lisp, m4, and Yacc.
The use of templates as a metaprogramming technique requires two distinct operations: a template must be defined, and a defined template must be instantiated.
Since these dictionaries are directly accessible(via an object's__dict__ attribute), metaprogramming is a straightforward and natural process in Python.
The metaprogramming language is thus identical to the host programming language, andexisting Lisp routines can be directly reused for metaprogramming, if desired.
As another, more significant, example of compile-time loop unrolling,template metaprogramming can be used to create length-n vector classes(where n is known at compile time).
Template metaprogramming allows the programmer to focus on architecture and delegate to the compiler the generation of any implementation required by client code.
TMP have no mutable variables- that is, no variable can change value once it has been initialized,therefore template metaprogramming can be seen as a form of functional programming.
Template metaprogramming is Turing-complete, meaning that any computation expressible by a computer program can be computed, in some form, by a template metaprogram.
If programs are modifiable at runtime or if incremental compilation is available(such as in C, Forth, Frink, Groovy, JavaScript, Lisp, Elixir, Lua, Perl, PHP, Python, REBOL, Ruby, Rust, SAS, Smalltalk, and Tcl),then techniques can be used to perform metaprogramming without actually generating source code.
This allows metaprogramming to be applied to virtually any target language without regard to whether that target language has any metaprogramming abilities of its own.
Lisp is probably the quintessential language with metaprogramming facilities, both because of its historical precedence and because of the simplicity and power of its metaprogramming.
In Lisp metaprogramming, the unquote operator(typically a comma) introduces code that is evaluated at program definition time rather than at run time; see Self-evaluating forms and quoting in Lisp.
Compile-time versus execution-time tradeoff If a great deal of template metaprogramming is used, compilation may become slow; section 14.7.1 of the current standard defines the circumstances under which templates are implicitly instantiated.
Template metaprogramming(TMP) is a metaprogramming technique in which templates are used by a compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled.
A fairly common example of using DSLs involves generative metaprogramming: lex and yacc, two tools used to generate lexical analyzers and parsers, let the user describe the language using regular expressions and context-free grammars, and embed the complex algorithms required to efficiently parse the language.
This makes metaprogramming easier than in a language without this property: reflection in the language(examining the program's entities at runtime) depends on a single, homogeneous structure, and it does not have to handle several different structures that would appear in a complex syntax.