Indirection (linguistics)
   HOME

TheInfoList



OR:

In computer programming, indirection (also called dereferencing) is the ability to reference something using a name, reference, or container instead of the value itself. The most common form of indirection is the act of manipulating a value through its memory address. For example, accessing a variable through the use of a pointer. A stored pointer that exists to provide a reference to an object by double indirection is called an ''indirection node''. In some older computer architectures, indirect words supported a variety of more-or-less complicated addressing modes. Another important example is the domain name system which enables names such as en.wikipedia.org to be used in place of network addresses such as 208.80.154.224. The indirection from human-readable names to network addresses means that the references to a web page become more memorable, and links do not need to change when a web site is relocated to a different server.


Overview

A famous aphorism of Butler Lampson goes: "All problems in computer science can be solved by another level of indirection" (the " fundamental theorem of software engineering"). This is often deliberately mis-quoted with "
abstraction layer In computing, an abstraction layer or abstraction level is a way of hiding the working details of a subsystem. Examples of software models that use layers of abstraction include the OSI model for network protocols, OpenGL, and other graphics libra ...
" substituted for "level of indirection". An often cited
corollary In mathematics and logic, a corollary ( , ) is a theorem of less importance which can be readily deduced from a previous, more notable statement. A corollary could, for instance, be a proposition which is incidentally proved while proving another ...
to this is, "...except for the problem of too many layers of indirection." A humorous Internet memorandum, , insists that: Object-oriented programming makes use of indirection extensively, a simple example being dynamic dispatch. Higher-level examples of indirection are the design patterns of the proxy and the proxy server.
Delegation Delegation is the assignment of authority to another person (normally from a manager to a subordinate) to carry out specific activities. It is the process of distributing and entrusting work to another person,Schermerhorn, J., Davidson, P., Poole ...
is another classic example of an indirection pattern. In
strongly typed In computer programming, one of the many ways that programming languages are colloquially classified is whether the language's type system makes it strongly typed or weakly typed (loosely typed). However, there is no precise technical definition o ...
interpreted languages with dynamic
datatype In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
s, most variable references require a level of indirection: first the type of the variable is checked for safety, and then the pointer to the actual value is dereferenced and acted on. Recursive data types are usually implemented using indirection, because otherwise if a value of a datatype can contain the entirety of another value of the same datatype, there is no limit to the size a value of this datatype could need. When doing symbolic programming from a formal mathematical specification the use of indirection can be quite helpful. To start with a simple example the variables ''x'', ''y'' and ''z'' in an equation such as z = \sqrt can refer to any number. One could imagine objects for various numbers and then ''x'', ''y'' and ''z'' could point to the specific numbers being used for a particular problem. The simple example has its limitation as there are infinitely many real numbers. In various other parts of symbolic programming there are only so many symbols. So to move on to a more significant example, in logic the formula ''α'' can refer to any formula, so it could be ''β'', ''γ'', ''δ'', ... or ''η''→''π'', ''ς'' ∨ ''σ'', ... When
set-builder notation In set theory and its applications to logic, mathematics, and computer science, set-builder notation is a mathematical notation for describing a set by enumerating its elements, or stating the properties that its members must satisfy. Defining ...
is employed the statement Δ= means the set of all formulae — so although the reference is to ''α'' there are two levels of indirection here, the first to the set of all ''α'' and then the second to a specific formula for each occurrence of ''α'' in the set Δ.


See also

* Handle * Delegation pattern * Pointer * Reference * Dereference operator * Law of Demeter


References

{{reflist Data types Programming constructs Computing terminology Unary operations