[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Defun inside Let



    Date: Thu, 30 Jan 1986 14:29 EST
    From: "Scott E. Fahlman" <Fahlman@edu.cmu.cs.c>
    Subject: Defun inside Let
    
    There can be no question at all on the point Jeff Dalton raises: when a
    Defun occurs inside a Let or anywhere else, it changes the GLOBAL
    function definition for the symbol in question.  It is not a form of
    LABELS.

To avoid any confusion: I agree with this interpretation of Common Lisp.  What
I'm wondering (and I'm beginning to think I'll wish I'd never asked this) is
why this interpretation was chosen over that in Scheme.  It's true that Common
Lisp doesn't normally go through forms and give certain subforms unusual
meanings, but is that all there is to it?

I have another question regarding functions, but this is only of the "Does
CLtL actually say everything it should?" variety.  If I do

   (flet ((b () 1)) (apply #'b ()))

I get 1, as expected, but if I use 'B or (SYMBOL-FUNCTION 'B) instead of #'b I
get an error telling me that B is undefined.  It is clear that I should get
this error [see pp 90 (SYMBOL-FUNCTION) and 107 (APPLY applied to a symbol)].
The description of FUNCTION (p 87) also indicates that it should work in this
case ("fn is interpreted as if it had appeared...").  But then,

   In particular, if fn is a symbol, the functional definition associated
   with that symbol is returned; see SYMBOL-FUNCTION.

For quite a while, I didn't think carefully about this and assumed that
FUNCTION was equivalent to SYMBOL-FUNCTION when applied to symbols.  And it
is equivalent except for symbols defined as local functions.  Should the
description of FUNCTION explicitly mention this exception, or is it clear
enough as is?

I hope this does not contribute to another furious debate.

-- Jeff