Figure
[3.2]
shows a simple environment
structure consisting of three frames, labeled I, II, and III. In the
diagram, A, B, C, and D are pointers to environments. C and D point
to the same environment. The
names
z and
x are bound in frame II, while
y and
x are bound
in frame I. The value of
x in environment D
is 3. The value of
x with respect to
environment B is also 3. This is determined as follows: We examine the
first frame in the sequence (frame III) and do not find a binding for
x, so we proceed to the enclosing environment
D and find the binding in frame I. On the other hand, the value of
x in environment A is 7, because the first
frame in the sequence (frame II) contains a binding of
x to 7. With respect to environment A, the
binding of
x to 7 in frame II is said to
shadow the binding of
x to 3 in
frame I.
図
[3.2]
は、I、II、III とラベル付けされた3つのフレームからなる単純な環境構造を示しています。図中で、A、B、C、D は環境へのポインタです。C と D は同じ環境を指しています。
名前
z と
x はフレーム II で束縛されており、
y と
x はフレーム I で束縛されています。環境 D における
x の値は 3 です。環境 B における
x の値も 3 です。これは次のように決定されます。シーケンスの最初のフレーム(フレーム III)を調べると
x の束縛が見つからないので、外側の環境 D に進み、フレーム I で束縛を見つけます。一方、環境 A における
x の値は 7 です。なぜなら、シーケンスの最初のフレーム(フレーム II)に
x を 7 に束縛する束縛があるからです。環境 A に関して、フレーム II における
x と 7 の束縛は、フレーム I における
x と 3 の束縛を
シャドウする(隠す)と言います。