((LAMBDA (X)
((LAMBDA (U V)
(PROGN (RPLACA U 'Z)
(CAR V)))
X X))
(CONS 'A '(B C)))
Puzzle #3
evaluate to A
or Z
? Again there are arguments for both possibilities.
Before we can meaningfully consider these questions, we must have a more precise notion of what we mean by "RPLACA
". Let us review its description:
If X
has as its value a non-atomic S-expression, and we evaluate the expression (RPLACA X Y)
, then after this evaluation, the value of the expression (CAR X)
is Y
.
This description depends upon a critical assumption. We have a notion of a thing which is the value of X, such that several references to the variable X all refer to the same thing. But what the **** do we mean by "same"??
The concept of side effect is inseparable from the notion of equality/identity/sameness. The only way one can observationally determine. that a side effect has occurred is when the same object behaves in two different ways at different times. {Note RPLACA Can Alter CAR Instead} Conversely, the only way one can determine that two objects are the same is to perform a side effect on one and look for an appropriate change in the behavior of the other.
In order to determine the answers to the Puzzles above, we must determine what properties are required of "sameness". There may be different points of view regarding sameness, which may lead to different answers to the Puzzles.
If we agree that the answer to Puzzle #1 is Z, then we have implicitly adopted the notion of consistency of variable reference, because we have referred to the variable X twice. As a property of the sameness predicate ≡, we write: (≡ X X)
. We can say that referring to a variable does not make a copy of its value (because if it did, the RPLACA in Puzzle #1 would have changed only a copy of the value of X and (CAR X)
would extract the car of a different copy, producing A).
Given this, and given that we accept the interpreter of Figure 11 and believe in its meta-circularity, we are forced to conclude that the answer to Puzzle #3 is also Z. We must consider all access paths and show that no copying can occur which would allow the answer to be A. The meta-circularity requires that any property of the interpreted language also hold for the text of the interpreter, and vice versa. The answer to Puzzle #1 requires that variable references not produce implicit copies, and so neither can variable references in the text of the interpreter.