CSC/ECE 517 Spring 2013/ch1b 1k hf

From Expertiza_Wiki
Revision as of 01:26, 19 February 2013 by Drhowar5 (talk | contribs) (expanding uses of meta programming)
Jump to navigation Jump to search
  • Here is a link to the writing assignment for this topic.
  • Here is a link to previous work on this topic.


A Basic Definition of Metaprogramming

The most basic definition of metaprogramming is: writing code that writes or manipulates code. <ref>Video Lecture on Metaprogramming by Dr. Gehringer</ref> <ref name="wiki metaprogramming">Wikipedia Article on Metaprogramming</ref>

A metaprogram can either manipulate itself, or it can manipulate some other program.

Below are three important terms associated with a metaprogramming<ref name="wiki metaprogramming">Wikipedia Article on Metaprogramming</ref>:
  • metalanguage - the language in which a metaprogram is written
  • object language - the language of the program that is being manipulated by a metaprogram
  • reflection - the ability of a programming language to be its own metalanguage (also known as reflexivity)


Uses of Metaprogramming

Metaprogramming can modify the behavior of a program at runtime.

This can allow programmers to write code that is more concise and more flexible. It can be more concise because a program that can write code is able to generate more code than it is initially given. It can be more flexible, because it can allow the program to change the way it behaves without having to recompile.

One of the best examples of metaprogramming is that of the compiler. A compiler uses code written in one language in order to generate code that can be executed by a computer.

Some languages, such as Ruby are interpreted languages.


References

<references/>