[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding terminology



    Date: Wed, 4 Feb 87 22:12 EST
    From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>

    I don't think you understood what I said.  What I said has nothing to do
    with implementation.  

Right.  I just went through this argument on some other mailing list. 
It has nothing to do with deep/shallow, which is purely an internal
implementation issue.  We're talking about language semantics.

Consider the following program fragment:

(defvar *a*)

(defun foo (x)
  (+ x *a*))

(defun bar-1 ()
  (let ((*a* 5))
    (x 4)))

(defun bar-2 ()
  (let ((*a* 9))
    (x 3)))

Now, consider the following question: "The body of x is a function-call
form that adds two variables.  The first variable is a lexical variable
named x.  Which variable is the second variable referenced by x?"

I believe that this question has a single, clear answer.  *x* always
refers to one particular variable, and it's that variable.

The alternative view is to say that there isn't any answer to the
question; it depends on who is calling foo, and what the environment is
at the time, and stuff like that.  Simply looking at foo does not tell
you what variable foo is talking about.  In order to explain Lisp this
way, you need to introduce some kind of new concept called an
"identifier" or something, that is separate from the concept of a
"variable", and say that the association from a given identifier to a
given variable depends, in some cases, on what conditions prevail at
runtime.  This mapping from identifiers to variables cannot always be
determined lexically, but must be determined dynamically.

Such a philosophy seems pointless.  Having gotten "rid" of dyanamic
binding of variables to values, you have replaced it with a new concept
of identifiers, and a dynamic binding of "identifiers" to "variables".
No complexity has been removed, and a new fundmental concept has been
added, resulting in a new gain in complexity for no benefit.