Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!inria!ilog!davis From: davis@ilog.UUCP (Harley Davis) Newsgroups: comp.lang.lisp Subject: Re: FUNCALL question Message-ID: <6904@ilog.UUCP> Date: 2 Feb 90 13:24:33 GMT Organization: ILOG, Paris, France Lines: 41 In-reply-to: gat@robotics.Jpl.Nasa.Gov's message of 1 Feb 90 00:15:46 GMT > > interpreted as a variable. Erann Gat made the mistake of calling > > these two interpretations the symbol-function and symbol-value > > when those terms are properly applied only to symbols (acting > > as global variables and function names). Local variables and > > function names don't have symbol-values or symbol-functions in > > that sense. > > I want to thank Jeff Dalton for coming to my defense. However, the > above is totally incorrect (said with a smile). Temporary variables > do have value and function bindings. That is why there are LET and > FLET forms in CL. For example: > > (flet ((x (x) (+ x x))) > (let ((x 1)) > (x x))) The above is totally incorrect (:^)). Jeff correctly pointed out that lexically-scoped variables do not, properly speaking, have symbol-values or symbol-functions, because these variables, despite all appearances, are not symbols. Special variables, on the other hand, are symbols, to which symbol-function and symbol-value are applicable. The non-symbolhood of lexical variables permits nifty compiler optimizations. The following code is erroneous unless x has been proclaimed special: (flet ((x (x) (+ x x))) (let ((x 1)) (list (symbol-function x) (symbol-value x)))) [ref. CLtL edition 1 p. 90] -- Harley ------------------------------------------------------------------------------ Harley Davis internet: davis@ilog.fr ILOG S.A. uucp: ..!mcvax!inria!davis 2 Avenue Gallie'ni, BP 85 tel: (33 1) 46 63 66 66 94253 Gentilly Cedex France