scope, and returning values by changing input args



   From: Richard Fateman <fateman at cs>
   
   It is not a good idea to try to change an input variable
   in macsyma programs  (or, for that matter, in any programming
   language which uses essentially call-by-value.  You are using
   call-by-value to pass the name of a global variable to be
   changed... and you have encountered the problem that the
   name you used has a binding in a different environment than
   the one you anticipated.  Macsyma asks "what is 'ind'?" and
   looks at all the binding that have been made, starting with
   the most recent in time, and the first 'ind' it finds is the
   one it uses.  This is dynamic scope.  Same as what maclisp
   had when macsyma was written.  Lexical scope would give you
   the binding of ind in the scope of the definition of the
   calling program.

A comment on the last sentence above: In a Lisp with lexical variables
it is not _possible_ to pass the name of a lexical variable outside
the lexical scope in which it is defined.  It makes no sense to do so,
since (unlike a dynamic variable) there is no semantics associate with
the name of a lexical variable at execution time.  In other words,
there is no relation between symbol naming a lexical variable and that
variable after the containing function has been promoted from a list
to a function (i.e. "compiled").