Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!ucsd!ucbvax!agate!shelby!neon!max From: max@Neon.Stanford.EDU (Max Hailperin) Newsgroups: comp.lang.lisp Subject: Re: Dumb Common Lisp question Message-ID: <1990Jul4.154304.7343@Neon.Stanford.EDU> Date: 4 Jul 90 15:43:04 GMT References: <4204@jato.Jpl.Nasa.Gov> <1990Jun29.162248.7846@Neon.Stanford.EDU> <1005@lehi3b15.csee.Lehigh.EDU> Distribution: usa Organization: Computer Science Department, Stanford University Lines: 44 In article <1005@lehi3b15.csee.Lehigh.EDU> jearly@lehi3b15.csee.Lehigh.EDU (John Early) writes: >In article <1990Jun29.162248.7846@Neon.Stanford.EDU> max@Neon.Stanford.EDU > (Max Hailperin) writes: > > In article <4204@jato.Jpl.Nasa.Gov> brian@granite.Jpl.Nasa.Gov > (Brian of ASTD-CP) writes: > >[...] I have one pressing question about CL. What is the rationale > >behind the (function ...) or #' construct? [...] > >I'm most familiar with Scheme/T, where this kind of thing is > >not necessary. All symbols are evaluated the same way [...] > >Treating a function as just another data type > >like integer or string seems very neat and clean. There must > >be some reason it's not done this way in CL. > > It's done this way for the sake of people who like to call an argument > that's a list "list" and still be able to use the "list" function, as in > > (defun foo (list) > "Return a list of the sum of the list and the sum-of-squares of the list." > (list (apply #'+ list) > (apply #'+ (mapcar #'square list)))) > > instead of having to call it the-list like you would in scheme. > [Of course, this applies to other names as well, list is just a common one.] >Since this is bad programming (at best) I suspect that that is not the reason. >I would guess that there is instead an historical/compatibility reason. Well, I was trying to cook up a simple example that gives the general flavor of the issue, and that is partially at fault. But yes, there is very definitely a historical compatability issue involved as well: the seperation between procedure and variable name spaces originated back in the days when all variables were dynamically scoped. Thus, you wouldn't just have to call your lists "the-list" instead of "list" if you yourself wanted to use the list proceudre. Rather, you would have to do it all the time unless you could be sure that no function you called--written in general by someone else--happened to use the list function. Further, higher-order procedures were a lot less used and usable in those days, so there wasn't as high a price to pay either. Procedures were almost always intended to be static top-level things, for which dynamic binding was almost always the wrong thing, so it made sense for them to be in a seperate namespace so you couldn't accidentally shadow them. These issues explain why what was appropriate for Lisp 1.5 wasn't appropriate for Scheme. Common Lisp, of course, decided to go with tradition.