Reflection and semantics in LISP

1. I n t r o d u c t i o n l"or three reasons, bi.';p's self-refi;rential properl.ies have not led to a general un(h:rst.auding of what it is fro" a cmuputational system to reason, in substantial way~, about its; owe operations a,ul structures. First., there is more to reasoning than reference; one also needs a theory, in terms of which to make .,~ense of the referenced domain. A comln, ter system able to reason about i t. : ; e l f-what I will call a reflective system-will therefore need an account of itself embedded within it. Second, there most he a systematic relationship between that embedded account and the system it describes. Without such a connection, the account would be useless-as disconnected an the words of a haple~;s drunk who carries on about the evils of inebriation, without reali~iug that his story applies to himself. Tl'aditional embeddiugs of IAsp in Lisp are inadequate in just this way; they provide no m e a n s for the implicit state of the Lisp process to he reflected, moment by moment, in the explicit terms of the embecbled account. Tlaird, a reflective system n m s t be given an appropriate vantage point at which to stand, far enough away to have itself in focus, and yet close enough to see the important details. This paper presents a general architecture, called procedurcd refh'ctio,, to support sell'directed reosoning in a serial programming lmaguage. Tim architecture, illustrated in a revamped dialect called 3-Lisp, solves all three problems with a single mechanism. The basic idea is to define an infinite tower of procedural self-nmdels, very much like mctacircular interpreters [Steele and S u s s m a n 1978b], except connected to each other in a simple but critical way. In such an architecture, any aspect of a procc~s's state that can be described in terms of One theory can be rendered explicit, in program accessihle structures. Furthermore, as we will see, this apparently infinite architecture can be finitely implemented. The architecture allows the user to define complex programming constructs {such as escape operators, deviant variableqmssing protocols, and dehugging primitives), by writing direct analogues of those metalinguistie semantical expressions that would normally be used to describe them. As is always true in semantics, the metatheoretie descriptions m u s t be phrased in terms of some particular set of concepts; in this …