[R] terminology for frames and environments
Gabor Grothendieck
ggrothendieck at myway.com
Mon Jun 14 14:30:08 CEST 2004
John Maindonald <john.maindonald <at> anu.edu.au> writes:
:
: > From: Peter Dalgaard <p.dalgaard <at> biostat.ku.dk>
: > Date: 14 June 2004 5:42:29 PM
: >
: > "Gabor Grothendieck" <ggrothendieck <at> myway.com> writes:
:
: >> .......................
: >> Could someone please clarify what standard terminology is?
: >
: > Not sure there is one...
: >
: > We have been approaching consensus on a couple of occasions, but
: > (obviously) not been too good at enforcing it. I think the consensus
: > is that a "frame" is a set of variable bindings (implemented as a
: > hashed list), an environment is a frame plus an enclosing environment,
: > i.e. a linked list of frames, terminated by NULL. It is occasionally
: > necessary to refer to the individual frames as opposed to the whole
: > list, which is exactly the point of the inherits argument.
: >
: > Notice that exists() talks about "enclosing" which is only ever used
: > in sense #1 above. "parent" is used in both senses (which is a bit
: > unfortunate -- not quite sure whether we have decided to get rid of
: > parent.env() eventually).
: >
: I have found it helpful, in trying to explain (to myself and others)
: what happens, to say that there is both a lexical stack and a call
: stack. Is that a legitimate use of terminology?
I would not use the term "stack" for the lexical one since, in that
case, the graph is not linear and not even connected although for
any particular environment (in the sense of an object with class
"environment") that environment and its lexical ancestors form a
linear structure.
Regarding Peter's comment, I would prefer to keep referring to an
environment as an object of class "environment" namely what
new.env creates, parent.env changes, is.environment
queries, etc. so that R does not need a massive change.
In that case I guess:
- frame and environment are synonyms
- enclosing environment is an environment together with its lexical ancestors
- the parent without further qualification is the lexical parent
- the caller or call parent is the environment one higher up on call stack
- an ordered set of environments can be used to refer to either the
call stack, an environment and its ancestors or other ordered set of
environments
More information about the R-help
mailing list