Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!strath-cs!dcl-cs!aber-cs!athene!pcg From: pcg@cs.aber.ac.uk (Piercarlo Grandi) Newsgroups: comp.lang.lisp Subject: Re: Shallow Binding Message-ID: Date: 27 Nov 90 23:36:40 GMT References: Sender: aro@aber-cs.UUCP Distribution: comp Organization: Coleg Prifysgol Cymru Lines: 35 Nntp-Posting-Host: teachk In-reply-to: kdr@doc.ic.ac.uk's message of 23 Nov 90 18:15:33 GMT Posting-Front-End: GNU Emacs 18.55.4 of Thu Nov 23 1989 on athene (berkeley-unix) On 23 Nov 90 18:15:33 GMT, kdr@doc.ic.ac.uk (K D Rigotti) said: kdr> I'm looking for a *very* small program to show shallow binding in kdr> action. Any suggestions? Ideally it should work for all versions kdr> of lisp including GNU Emacs lisp (if that has shallow binding??) Shallow binding is an implementation technique. It cannot be observed or demonstrated at the language level, as it just influences the execution time of variable references in deeply nested lambda calls; it *might* be possible to concoct a very contrived example that recurses many levels deep and then makes repeated references to a fluid variable up in the environment tree; with shallow binding the recursion would take more time than with deep binding, but references to the fluid variable would take less time than with deep binding. I doubt that one can actually create a simple example in which the difference is observable (the levels of recursion must be many). Shallow binding and other implementation techniques are deep binding and cached binding. All these are discussed in Baker's CACM article (1975) "Shallow binding in Lisp 1.5". There is a possibility that you are instead interested in the difference between dynamic and static scoping, which is instead a language level feature. Any good book on Lisp will explain the difference between the binding and the scoping problems. Virtually the only Lisp dialects that have static scoping by default are Common Lisp and Scheme; all others support dynamic scoping by default, including GNU Emacs lisp. For full background and details on both the binding and the scoping issue read John Allen's book, "The Anatomy of Lisp", published by Academic Press. -- Piercarlo Grandi | ARPA: pcg%uk.ac.aber.cs@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcsun!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk