Path: utzoo!attcan!uunet!mcvax!ukc!etive!aiva!jeff From: jeff@aiva.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: What's the value of lexical scoping? Keywords: Scope, Binding, Locals, Break, Future of LISP Message-ID: <480@aiva.ed.ac.uk> Date: 4 Jul 88 19:48:44 GMT References: <24508@ucbvax.BERKELEY.EDU> <515@dcl-csvax.comp.lancs.ac.uk> <452@aiva.ed.ac.uk> <519@dcl-csvax.comp.lancs.ac.uk> Reply-To: jeff@uk.ac.ed.aiva (Jeff Dalton) Organization: Dept. of AI, Univ. of Edinburgh, UK Lines: 40 In article <519@dcl-csvax.comp.lancs.ac.uk> simon@comp.lancs.ac.uk (Simon Brooke) writes: >This is, in my opinion (not, I admit, widely shared as yet) one of the >worst of the Common LISP messes. It is the nature of LISP that code is >built up incrementally. You build your system on the top of my system. Let >us say that you are a mortal and I am a hearty adventurer. How are you to >know which tokens I have declared special? Well, I *ought* to have >documented them; or you could always read the source file; or, as a last >gasp, you could always, *every single time you use a new variable* ask the >system whether I've already declared it special. But are you *really* >going to do these things? No. Mixing your binding schemes is asking for >trouble - and trouble of a particularly nasty sort. Actually, you are not the only one who makes this argument. The reasons I do not find it convincing are: 1. The same naming convention you suggest earlier in your message -- that the names of dynamic variables begin and end with "*" -- can be (and is) used in Common Lisp. So I don't have to, as a last gasp, every single time, etc. 2. While it is true that I might not know that someone whose code I use has declared X special (i.e., dynamicly scoped), I also may not know that s/he has defined a function F. Name conflicts of this sort are not introduced by having both lexical and dynamic scope. Indeed, they are *less* likely than in Lisps where every variable is dynamic. The Common Lisp mixture of lexical and dynamic scoping is not perfect, but the problems for the most part involve technical details not the mere fact that both lexical and dynamic scope are available. For example, there is no way in Common Lisp to guarentee that a variable is not special. In (LET ((A 10) ...), A might have been proclaimed special somewhere, and there's no way to turn that off. But this is because special proclamations affect all bindings as well as all references, not because special variables exist at all. Jeff Dalton, JANET: J.Dalton@uk.ac.ed AI Applications Institute, ARPA: J.Dalton%uk.ac.ed@nss.cs.ucl.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!J.Dalton