[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Binding terminology
- To: Moon@STONY-BROOK.SCRC.Symbolics.COM
- Subject: Re: Binding terminology
- From: Mark S. Miller.PA <Miller.PA@Xerox.COM>
- Date: Wed, 04 Feb 1987 22:05:00 -0000
- Cc: cugini@ICST-ECF.ARPA, firstname.lastname@example.org, VulcanCore^.pa@Xerox.COM
- In-reply-to: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>'s message of Wed, 4 Feb 87 17:29 EST
- Sender: Miller.pa@Xerox.COM
Date: Wed, 4 Feb 87 17:29 EST
From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
Dynamic variables really are one object with a changeable
property. Lexical variables, on the other hand, are separate
objects referred to by the same name in separate scopes.
Only if your conceptual model corresponds to shallow binding. (sorry
for introducing an orthogonal use of "binding" into this discussion) My
conceptual model for dynamic variables corresponds to deep binding. In
shallow binding, new dynamic bindings (as introducted by LET) assign to
a variable and remember to undo this assignment on exit from the LET.
In deep binding, LETs introduce new name-variable associations.
Specifically, I think of CommonLisp as if it were compiled into a
lexically-scoped-only lisp (LexicalLisp) as follows:
Every CommonLisp function is compiled into a LexicalLisp function that
has an additional parameter: a dynamic naming environment. This is
much like compiling a call-return lisp into a call only lisp by
introducing an additional continuation parameter. The dynamic naming
environment is an object that associates symbols with variables
("variables" in the new suggested meaning).
In the absence of any LETs, etc. of special variable names in a function
body, all calls in a function would be compiled to pass on the same
dynamic naming environment received by this function. What a LET form
does is to create a new environment consisting of the old environment +
a new contour associating names (symbols) with new variables. This
environment is then used within the body of the LET as the current
dynamic naming environment. References to special variable names are
compiled into requests to the current dynamic naming environment to
lookup the variable associated with this name.
This model is conceptually simple, you don't have to worry about undoing
bindings (or assignments) when you leave dynamic extents (including
abnormal exits), there is no problem with introducing parallelism, and
we could consistently use the new terminology without guilt. It is also
a valid description of what it is that's being implemented by the
typical stack lookup implementation of deep binding (such as Interlisp).
I suggest that our terminology reflect this model, and that shallow
binding only be considered a particular way it can be implemented.