[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: firstname.lastname@example.org
- Subject: function redefinition.
- From: email@example.com (Bill Schelter)
- Date: Wed, 30 Dec 87 18:09:53 CST
- Posted-date: Wed, 30 Dec 87 18:09:53 CST
Two questions involving changing of a symbol-function of a symbol.
I) Is it permissible in common lisp for a function FOO
to call a function which may redefine FOO?
This is useful for defining autoloading, or self compiling
functions. I was not able to find anything in the manual
authorizing this. I would like to use this feature, in some
code which I want to be very pure common lisp.
Does anyone know of a common lisp implementation where this
is not valid, or perhaps some text in the manual which might
authorize such behaviour?
(defun foo (&rest l)
(apply 'foo l))
II) What is the approved order of evaluation of in the call
(foo a), or is it left undefined.
For examble if I have a file containing the following three forms:
(defun foo (x) x (print "hi"))
(defun goo (y) x (print "bye"))
(defun test () (foo (setf (symbol-function 'foo) (symbol-function 'goo))) )
Then for symbolics and kcl,
interpreted (test) ==> "hi"
compiled (test) ==> "bye"
I am happy with the order being undefined, I just wondered if this
was indeed supposed to be so, or if I should fix it in kcl.
Of course for speed in compilation, the "bye" answer is what
fits in most easily, since you want we want to push the args
and then call the function, so we don't want to have to save
its address before pushing the args.