interpretation of variables
evaluation
- every expression is evaluated in an environment
- a variable is evaluated by looking up its value in that environment
- start with the first frame, and move thru the frames until a binding is found
a variable’s value in one frame may not be accessible because
- that frame is not within the current environment
- the variable is shadowed by a binding for the same variable in an earlier frame
examples
- in env E1, (+ x y z) evals to 7
- in env E2, (+ x y z) does not eval
- in env E2, (+ x z) evals to 6
- in env E2, (+ x z) evals to 5
-
- in E1, E2’s x is shadowed
- in E2, E1’s x is not accessible