[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: David Bein <pyramid!bein@SUN.COM>
- Subject: funcall
- From: Rob MacLachlan <RAM@C.CS.CMU.EDU>
- Date: Sat, 26 Apr 1986 19:39:00 -0000
- Cc: common-lisp@SU-AI.ARPA
- In-reply-to: Msg of 26 Apr 1986 12:19-EST from David Bein <pyramid!bein at SUN.COM>
Date: Saturday, 26 April 1986 12:19-EST
From: David Bein <pyramid!bein at SUN.COM>
Suppose we have the following code:
(defun mumble (a)
(flet ((mumble (a) (print "internal-mumble")))
(when (something a) (funcall 'mumble a))
Is it 100% legal to pass funcall a symbol? Most implementations I
have seen allow this although the manual tends to imply that the
thing being funcall'ed must be a "function".
It is pretty clear that passing a symbol to FUNCALL is legal.
Although it doesn't say so in the funcall description, it is
explicitly allowed in APPLY. It would be pretty silly not to apply
the same rule to FUNCALL. I would say that regardless of whether a
symbol is a function or not, it is legal to pass a symbol to FUNCALL.
Is a compiler justified in simply turning this into a call to mumble
as if it had been written as (mumble a) in the first place?
No, as in APPLY, calling a symbol calls the global definition.
Another related matter, suppose we change the funcall arg to
#'mumble --> (function mumble). Is it clearly the case then that
the mumble which is apparent is the inner one?
Yes, FUNCTION evaluates a "functional expression" in the lexical
environment at the point of call.