My response was "bah" -- Lisp allows you to redefine
functions -- even the builtin ones (although this is
not generally a good idea).
I may be repeating what others have said, but I half agree with your
"bah." CMUCL should you warn you (as some other Lisp implementations
do) when you're about to redefine something you shouldn't.
The right way to redefine a system symbol (i.e., a function, macro, or
whatever) is to
(a) Set up your own package. I suppose you could use :cl-user, but
not for anything serious.
(b) Shadow the symbol you want to redefine.
(c) Define your version. Hopefully it's an extension to the normal
behavior so that none of your code has to change. However, the one
place you need access to the original is in the definition of the new
version. For instance, I would like to be able to write
(defun foo (x _ z) ...)
instead of
(defun foo (x y z) (declare (ignore y)) ...)
I define it thus:
(defmacro defun (name args &rest body)
(multiple-value-bind (args body)
(ignore-smooth args body)
`(cl:defun ,name ,args ,@body)))
where ignore-smooth does the transformation I want.
That's step (c). Step (b) is
(in-package :my-own-package)
(eval-when (:compile-toplevel :load-toplevel :execute)
(shadow '(#:defun)))
Between step (b) and step (c) I have to write 'cl:defun' instead of
'defun' because 'defun' is not defined yet.
-- Drew McDermott