Path: utzoo!attcan!uunet!mcvax!ukc!its63b!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: <452@aiva.ed.ac.uk> Date: 9 Jun 88 18:41:27 GMT References: <24508@ucbvax.BERKELEY.EDU> <515@dcl-csvax.comp.lancs.ac.uk> Reply-To: jeff@uk.ac.ed.aiva (Jeff Dalton) Organization: Dept. of AI, Univ. of Edinburgh, UK Lines: 90 In article <515@dcl-csvax.comp.lancs.ac.uk> simon@comp.lancs.ac.uk (Simon Brooke) writes: >In article <24508@ucbvax.BERKELEY.EDU> mkent@dewey.soe.berkeley.edu (Marty Kent) writes: >>I've been wondering lately why it is that "modern" lisps like Common Lisp >>and Scheme are committed to lexical scoping. > >Good! somebody else prepared to stand up and say Common LISP is a mess. If >you share this opinion, read the end of this posting even if you skip the >middle... it is important. I will respond to this, because I have talked with Simon before on Uk.lisp, and because I am familiar with the various standardization efforts mentioned in his message. Nothing I say has any official standing of course. For one thing, it is significant that Marty Kent mentioned Scheme as well as Common Lisp. He did not say Common Lisp is a mess, nor did he mention any problem with Common Lisp other than the effects of its use of lexical scope on debugging. I therefore think it a bit unfair to enlist him in the anti-Common Lisp cause just yet. This exchange is a sign of a general problem faced by the Lisp community, namely that we are trying to standardize Lisp at a time when our conception of the language is changing. One aspect of this change is the move towards lexical scoping. In addition, there is a problem of "uneven development": some people have gone further than others or in a different direction. I do not mean to imply that those who have gone further are right. Nonetheless, it may be difficult to explain "modern" Lisp without retracing a lot of history. It may even be that the only way to understand is to try out the other point of view and see what it's like. My own thinking on these matters was informed in part by the first Scheme papers by Steele and Sussman starting in 1975, by Stoy's book on Denotational Semantics (see especially his comments on 1st-class functions), and by two papers in the Conference Record of the 1980 Lisp Conference: Kent M. Pitman. Special Forms in Lisp. Pages 179-187. [An argument that macros are better than fexprs] Steven S. Muchnick and Uwe F. Pleban. A Semantic Comparison of Lisp and Scheme. Pages 56-64. [In part a reconstruction of Lisp development, as is Steele and Sussman's "The Art of the Interpreter".] [For other references, see the R*RS Scheme reports.] Scheme-like ways of thinking were not immediately convincing, but experience with Scheme showed that such an approach had virtues despite seeming to impose a number of restrictions. For one thing, the lexical resolution of the differences between interpreter and compiler semantics (many Lisps have partial lexical scoping in compiled code but only dynamic scoping in interpreted) began to seem better overall than the dynamic resolution (have compiled code use dynamic scoping too), as did the lexical form of functional values. These ideas eventually became strong enough to influence Common Lisp: - Common Lisp has lexical scoping with indefinite extent. - Common Lisp does not support user-defined special forms. - Common Lisp uses the same rules of scope and extent for both interpreted and compiled code. It is important to note that for many these are all good things. In particular, it is likely that all three will be true of any Lisp standard, whether developed by x3j13 or ISO's WG-16. They are also true of the suggestions made by the EuLisp committee. Indeed, one of the key questions now is how much further in the Scheme direction the standard should move. However, to others these things are all bad things and represent capitulation to the forces of Pascal, or something of that sort. In addition, some, and I think Simon is among them, find Common Lisp a confusing mixture. They prefer both Scheme and "dynamic Lisp" to Common Lisp, but still prefer dynamic Lisp to Scheme. Such a position is not simply a complaint that Common Lisp has lexical scoping; it is more complex. If they would like a standard that improves on Common Lisp in some respects, it may be possible to achieve one; but I do not think the Lisp community has the resources or the inclination to build a standard for dynamic Lisp. This seems enough for one message; I will respond further in the next. 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