My mistakes

Reflection (computer science)

Posted on: October 26, 2007

In computer science, reflection is the process by which a computer program of the appropriate type can be modified in the process of being executed, in a manner that depends on abstract features of its code and its runtime behavior. Figuratively speaking, it is then said that the program has the ability to “observe” and possibly to modify its own structure and behavior. The programming paradigm driven by reflection is called reflective programming.

Typically, reflection refers to runtime or dynamic reflection, though some programming languages support compile time or static reflection. It is most common in high-level virtual machine programming languages like Smalltalk, and less common in lower-level programming languages like C.

At the lowest level, machine code can be treated reflectively because the distinction between instruction and data becomes just a matter of how the information is treated by the computer. Normally, ‘instructions’ are ‘executed’ and ‘data’ are ‘processed’, however, the program can also treat instructions as data and therefore make reflective modifications.

With higher level languages, when program source code is compiled, information about the structure of the program is normally lost as lower level code (typically machine language code) is produced. If a system supports reflection, the structure is preserved as metadata with the emitted code.

In languages that do not make a distinction between runtime and compile-time (Lisp, Forth and MUMPS, for example), there is no difference between compilation or interpretation of code and reflection.

 more… 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: