8. Conclusions

Self-reference occurs whenever a system loops back on itself and describes some aspect of its own form or structure. It occurs frequently in the world, and has practical applications in domains such as mathematics and theoretical computer science.

The use/mention distinction plays an important role in self-reference. To use something is to exploit its content and meaning. To mention something is to refer to its form and appearance.

Self-reference occurs frequently in the domain of computer programming. Structures such as linked lists embody the use/mention distinction.

Self-documenting programs are a simple idea - a program that, when run, produces itself as output. The task of writing a self-documenting program is not nearly as easy as it sounds. In a certain sense, it is impossible to ever begin.

The brute force approach at a self-documenting program fails because we get caught in an infinite loop of adding an instruction to output a previous instruction.

Merely taking the description of the program out of the code fails bacause the resulting program outputs only a use, and not a mention.

The problem is further complicated by the way C handles the use/mention distinction internally: one cannot mention double quotes or newlines in a string without escaping them.

By finding an alternate expression for these special characters, such as an encoding like ASCII, one can write true self-documenting programs. Such programs tend to be cryptic and difficult to read.

These self-documenting programs can be made more elegant by using the printf function's capacity for format specifiers.

ASCII is not the only encoding used in the world; this foils some self-documenting programs, causing them to give incorrect output on some computers.

Printf is not part of the C language, but defined as a part of its standard pbraries. Although this introduces a dilemma as to what functions one should be allowed to use as helpers in ones program, functions in standard libraries should be permitted in self-documenting programs anyway.

Whether or not to consider a program self-documenting also depends on what we identify as 'itself' when referring to a program. The file that contains the program's source seems to exist at too high a level. The representation of the program in the computer's memory at runtime seems too low.

Our definition of a self-documenting program should be revised to specify that the program be implemented in a sufficiently complex language, that it be able to run in isolation from its source, and that its output also be a self-documenting program.

[back] [up] [right]