Subject: Re: quest for pass-by-reference semantics in CL
From: Erik Naggum <>
Date: Sun, 05 May 2002 16:51:13 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Erann Gat
| I'll tell you exactly how they get screwed up: they read the wrong books.

  So we push the problem one step back and have not answered the question
  but have to ask ourselves how the authors got screwed up, instead.

| They read K&R and Stroustrup or C++ for Dummies, and as a result they
| have no idea what a binding is.  And it's not their fault.  It's very
| hard to find a good definition of the word "binding" (as a noun) in
| published works.  If you don't believe me, time yourself to see how long
| it takes you to find one (not including the Hyperspec, of course).

  H.P.Barendregt: The Lambda Calculus, Its Syntax and Semantics.  1 second.
  (It is within reach from where I sit.)  He discusses variables in an
  appendix and refers to Frege and Pierce for defining the nature of free
  and bound variables.  The term "binding" is mathematical in nature and
  comes from the concept of free and bound variables.  H.P.Barendregt has
  also been published in Handbook of Logic in Computer Science, vol 2,
  Background: Computational Structures and in Handbook of Theoretical
  Computer Science, vol B, Formal Methods and Semantics, where he also
  writes about lambda calculus.  Lambda calculus was my first guess.

  Then I went back to my undergrad CS texts, just to see if there were any
  useful references.  I found H.R.Lewis, C.H.Papadimitriou: Elements of the
  Theory of Computation and C.Ghezzi, M.Jazayeri: Programming Language
  Concepts both to explain it briefly but accurately.  A.V.Aho, J.D.Ullman:
  Foundations of Computer Science also covers free and bound variables
  under predicate logic.  Of course, SICP covers binding, but slightly
  better in the first edition than the second.

  My third choice of literature to search for this would be in compiler
  literature.  The seminal work of A.V.Aho, R.Sethi, J.D.Ullman: Compilers;
  Principles, Techniques, and Tools, covered binding accurately and well.
  D.Grune, H.E.Bal, C.J.H.Jacobs, K.G.Langendoen: Modern Compiler Design
  covers it in Logic Programming, where they refer to bound and unbound
  variables.  Most other compiler books cover the problem of binding
  without calling it binding.

  My fourth guess was that the O'Reilly books on Perl and Python ought to
  say something about this, but Perl only uses it in relation to the tie
  operator and Python does not mention it at all.  So I checked Programming
  Ruby, which I recalled have a binding operator, and true enough, we find
  that it explains the variable bindings of a block very well and supports
  access to these bindings.

  By this time, I had spent 20 minutes pulling some 30 books out of my
  1100-volume strong personal library and had found 12 hot hits.  So not
  only did I know roughly where to look, it was where I thought I would
  find it.  If any the other books also have a description of binding, I do
  not know, but I am not at all unhappy with the hit rate.

  Of course, I excluded all Lisp books.  Anatomy of Lisp, Lisp in Small
  Pieces, Common Lisp the Language, etc, all cover bindings excellently.  I
  also excluded all Java, Ada, and C++ books because I cannot recall that
  any of them have ever mentioned bindings by that name.

  I believe that if you grasp free and bound variables in mathematics (i.e.
  calculus), predicate logic, and lambda calulus and figure out things like
  scope, then lexical environments, and you read just a little bit about
  compilers, the idea of a binding will emerge without serious mental
  effort.  The fact that Common Lisp exposes what in other languages are
  gone by the time the compiler has finished with it and so not available
  in the runtime environment tends to obscure and hide these issues from
  their users.  The lack of binding capture in closures (because they
  simply do not exist) tends to make it unnecessary to know about them.
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  70 percent of American adults do not understand the scientific process.