[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: symbol-function of non-functions
Date: Thu, 22 Jan 87 16:56 EDT
From: Randy@a
Actually, I've always wondered why SYMBOL-FUNCTION has to signal
an error if the symbol does not have anything in its function cell.
If it is in an attempt to be parallel to SYMBOL-VALUE, then what
about SYMBOL-PLIST and SYMBOL-PACKAGE? SYMBOL-VALUE has to be special
since NIL is an allowable value for a symbol to have, but NIL in
a function cell would mean that there is no function.
Not at all. It means that a further indirection needs to be taken since
NIL is itself a symbol. The indirection looks for the functional value
of NIL, which is presumably unbound, and will then generate an error.
Does all of
this mean that it is incorrect to (SETF (SYMBOL-FUNCTION 'FOO) NIL)
and that one *has* to use FMAKUNBOUND instead?
You can do (SETF (SYMBOL-FUNCTION 'FOO) NIL) and then (FOO) will try to
invoke NIL as a function because of the indirection stated above, and
the fboundness of NIL will determine what will happen. So... to make a
symbol globally funbound, you do have to use FMAKUNOUND.