From: Harley Davis
Subject: Re: FUNCALL question
Date: 
Message-ID: <6904@ilog.UUCP>
 > > 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: ·····@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
From: Jeff Dalton
Subject: Re: FUNCALL question
Date: 
Message-ID: <1678@skye.ed.ac.uk>
In article <····@ilog.UUCP> ·····@ilog.UUCP (Harley Davis) writes:
>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]

Um, isn't it erroneous even if X _has_ been proclaimed special?

For instance, in

     (list (symbol-function x) (symbol-value x))))

both SYMBOL-FUNCTION and SYMBOL-VALUE will complain because they're
being called on the number 1.  That will happen even if X is special.
We might try quoting X, but SYMBOL-FUNCTION will still complain,
because special declarations don't affect function bindings.

-- Jeff