Evaluation frames

Splus can attach the same name to different values in different contexts (as in the case of the foo() function). See Becker et al, section 5.4, or Venables & Ripley, section 4.5. Each context corresponds to a different evaluation frame.

When Splus needs to evaluate an object--let me call it fred--it has a number of places to look. It uses the first fred that it finds, even if that fred is not the one you had intended.

When Splus is started it can create temporary objects, which disappear when you quit from the program. These objects live in frame 0.

When you type in a command, Splus creates a temporary frame 1 to evaluate objects. During the evaluation, various functions might be called, and various new objects might need to be created. For these Splus creates a hierarchy of new temporary frames, 2, 3, ... .

If Splus wants to know the value of an object, it first looks in the current frame, then in frame 1, then in frame 0, then it looks down the search list. An object created in frame 5, say, will not be located when Splus is busy in frame 6.

Some of the mysteries of evaluation were discussed in the S-news: HELP.

See also some correspondence I had concerning evaluation.