[R] terminology for frames and environments

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Jun 14 14:33:09 CEST 2004


Gabor Grothendieck <ggrothendieck at myway.com> writes:

> : > 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.

....

> 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 

No. Please read what I wrote again.

> - enclosing environment is an environment together with its lexical ancestors

No. It *is* the lexical ancestor(s).

> - the parent without further qualification is the lexical parent 

No. (In particular, sys.parent() is not)

> - the caller or call parent is the environment one higher up on call stack   

...which is a tree! and the parent caller is not necessarily the one
one step above in the *context* stack. (Go play with sys.status()
until you understand this.)

> - 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

Er, what do you mean by that...???

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list