Reflection

Etymologically, reflection is first a term about turning back the image of another object; since the phenomenon was mostly used to see oneself with mirrors (the alternate spelling reflexion is preferred for the optical phenomenon), it has come to mean applying to oneself (see reflexive). From there, it has come to mean not just to see oneself's physical image, but also to examine one's own mental state (early 17th century), and quickly applied to thinking in general (late 17th century), and has been used for well considered thought in general, although still keeping as an alternative this meaning of thinking about one's thoughts.

In Computer Science, Reflection is the domain of programs that (effectively or potentially) describe and manipulate "themselves", or other related programs. This notion extends to programs the philosophical notion of Reflection of human thought that can apply to itself. The idea is not quite new, and has been used by the founding fathers of formal logic and computer science in their early theorems on the power and limits of reasoning and computation (Cantor, Gödel, Turing, etc).

We sometimes say reflective for potentially reflective, and likewise say reflection instead of potential reflection. In this above meaning, programming is a reflective activity, as one can program programs that program. A programming language or an operating system is called reflective if suited to reflective metaprogramming, that is, if it has provides programs some special ability to read and write themselves or other related programs. Actually, such reflection is often obtained as an interesting side effect of a more general and useful property, universality with respect to meta-programming.

Computational Reflection in particular is the ability to describe inside a language the semantics of further programs. The whole point about it is that it and only it allows full control for all programs of what is to be explicit, and what is to be implicit in the semantics of these programs.

We think that Reflection is just needed for computer development, and can be justified by a cost analysis that can be formalized in terms of computational complexity. If you want to develop a computer system from a supported computer system, then there must be Reflection somewhere in the system. On most current systems, that Reflection might be hidden, and might need a reboot everytime it is used (with loss of all current data, unless measures are taken manually): for instance, Linux can be developed from Linux, but you must kill all processes and reboot so as to replace a current Linux with a developed Linux.

Consider then the following simple cost analysis. If I is the cost of all the irreflective abstraction layers between the hardware and the first reflected part P of the system; if R is the cost of all the abstraction layers that help reflect P into itself, then the cost of doing k reflective operations is greater than I+k*R (for compiled implementations; interpreted approaches may be exponentially worse). Current systems are such that all this often is a prohibitive cost, and as a consequence, even though all systems are somehow reflective, reflection is only marginally used. Now, the cost of not using computerized reflection is to do by hand what the computer would do automatically, hence having lots of automatizable tasks be done by humans, and moving to them humans the responsibility of ensuring the consistency of such a complex system. The result is a drastic decrease in productivity and reliability, and consequential limitations in achievements.

The term reflection is also used to mean the operation which inverts reification. In this sense the term is a synonym of deification (Wand, Friedman) and absorption (De Meuter).

See our review of methods of reflection.


Pages in this topic: Reflection 101   Reflection in Maude  


Also linked from: AdaOS   Constructor and Destructor   Cybernetics   Inheritance   Java   Maude   Metaprogramming   Methods of Reflection   Moostrap   Napier88   nitrOVM   NuPrl   Pliant   Reflective Tower   Reflexive   Site Map   Static   TCL   Transparent   Tube