# 2. Self-Reference

### What is self-reference?

Self-reference occurs whenever a system loops back on itself and describes some aspect of its own form or structure. This mysterious phenomenon happens all the time. Whenever someone says 'I' or 'me', whenever a movie talks about movies or a television program talks about television programs, self-reference is being demonstrated.

Self-reference has some important applications, too. The proof of Gödel's Incompleteness Theorem, one of the most far-reaching concepts in mathematics and logic, relies on a formal system being able to describe its own structure. Turing used the idea of a self-referential computer program to provide a proof to the Halting Problem, an important question of computer science.

### The use/mention distinction

An important aspect of self-reference is the differentiation between 'use' and 'mention'. To use something is to actually employ its meaning, to get at its deeper content. To mention something, on the other hand, is merely to refer to its form, its outer appearance. For instance, consider the following two sentences:

This sentence has five words.
"This sentence" has two words.

Intuitively, both sentences assert true propositions. Yet despite the nearly identical choice of words, they make these assertions in entirely different ways. The distinction is in the words "this sentence". In the first sentence, "this sentence" is being used. It is actually being employed, and the reader forms a mental association between the words and their meaning, namely the sentence as a whole. On the other hand, in the second sentence "this sentence" is being mentioned. The content of the two words is unimportant, because there is no attempt to derive meaning from them. All that matters is that the phrase "this sentence" does indeed have two words.

Note that people are able to see this distinction automatically, without thought. Although this sentence does not occur at all in the previous paragraph, "this sentence" occurs many times. And each time, the reader has no problem understanding that "this sentence" is being mentioned rather than used. As another example, when reading this sentence, the reader has no trouble distinguishing between the two contexts of "this sentence".

### Computers and self-reference

Computer programming is full of self-reference. It is becoming nearly impossible to avoid playing with these kinds of loops in modern programming languages. For example, one of the most fundamental structures used by programmers is the linked list. A typical declaration of a linked list looks like this:
```    struct link {
int          data;
};
```
This fragment of code declares a new type - a template from which to construct objects later. In this case, the type is declared as an aggregate which contains two subobjects: some piece of numerical information, called `data`, and a pointer to another `link` structure, called `next`.

This simple structure embodies the use/mention distinction. If I declare an object of type `struct link`, the computer will set aside memory to hold my new object. This block of memory will behave according to its definition, and allow access to two subobjects of the appropriate types. This new object is a use of a link. But notice how the second subobject is defined as a pointer to another link. A pointer is the encoding of a location in memory. It does not make sense for `next` to be of type `struct link`; that would make the type infinitely large! So `next` is not a link itself, but indicates where another such object can be found. It is a mention of a link.

[back] [up] [right]