[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FUNCTION and MACROLET
Date: Fri, 2 May 86 17:43:51 pdt
From: yuasa@kurims.kurims.kyoto-u.junet
To: Common-Lisp@SU-AI.ARPA
Message-ID: <8605030043.AA01090@kurims.kyoto-u.junet>
Subject: FUNCTION and MACROLET
To sum up, there are two possibilities:
[A] (MACROLET ((FOO ...)) (FUNCTION FOO)) causes an error, and
SYMBOL-FUNCTION with non-function symbol also causes an error.
[B] (MACROLET ((FOO ...)) (FUNCTION FOO)) returns some totally random object
which, when invoked as a function, will cause an error. SYMBOL-FUNCTION
with non-function symbol also returns something not a function.
CLtL supports [B]. Also Guy's proposed clarification seems to support [B].
However, [B] forces the compiler to INVENT something not a function, and to
silently generate code that returns the something, although this something is
totally useless. Rather, the compiler should cause an error when processing
the above MACROLET form. I prefer [A]. As Rob said, the difference of [A]
and [B] do not matter actually. In addition, it will be straightforward
to change an already existing implementation toward [A]. (Indeed, I think
I could do the change in five minutes for KYOTO!!)
The above discussions (and the discussions of Bob and Nick) are based on
Nick's assumption that FUNCTION with a symbol should correspond to
SYMBOL-FUNCTION in sense that a symbol as a variable corresponds
to SYMBOL-VALUE). Is this what most people agree with? Yes, the description
of FUNCTION in CLtL says
...; see SYMBOL-FUNCTION.
The reader of CLtL might see the description of SYMBOL-FUNCTION. Perhaps
he would like to say "yes, I saw it... so what?"
Nick's assumption is wrong here. On pg. 32 it says "The result of
evaluating a FUNCTION special form will always be a function."
Thus, even in the current CLtL, FUNCTION and SYMBOL-FUNCTION are
not defined to behave identically in the the case of a symbol that
globally names a macro or special form.
Given that FUNCTION is not defined to work with symbols naming
non-functions and given that MACRO-FUNCTION can be used to assign a
new name to a macro, and given that we probably want it to be illegal
to give a new name to a special form (I think we discussed this aspect
of SYMBOL-FUNCTION once), then I agree that [A] is the best solution
(assuming that "causes an error" does not mean "signal an error" but
merely "is an error").
-- Nick