-;;; Convert a function name to its standard SETF function name. We
-;;; have to do this hack because not all Common Lisps have yet
-;;; converted to having SETF function specs.
-;;;
-;;; KLUDGE: We probably don't have to do this any more. But in Debian
-;;; cmucl 2.4.8 the :SETF feature isn't set (?). Perhaps it's because of
-;;; the comment ca. 10 lines down about how the built-in setf mechanism
-;;; takes a hash table lookup each time? It would be nice to go one
-;;; way or another on this, perhaps some benchmarking would be in order..
-;;; (Oh, more info: In debian src/pcl/notes.text, which looks like stale
-;;; documentation from 1992, it says TO DO: When CMU CL improves its
-;;; SETF handling, remove the comment in macros.lisp beginning the line
-;;; #+CMU (PUSHNEW :SETF *FEATURES*). So since CMU CL's (and now SBCL's)
-;;; SETF handling seems OK to me these days, there's a fairly decent chance
-;;; this would work.) -- WHN 19991203
-;;;
-;;; In a port that does have SETF function specs you can use those just by
-;;; making the obvious simple changes to these functions. The rest of PCL
-;;; believes that there are function names like (SETF <foo>), this is the
-;;; only place that knows about this hack.
-(eval-when (:compile-toplevel :load-toplevel :execute)
-; In 15e (and also 16c), using the built-in SETF mechanism costs
-; a hash table lookup every time a SETF function is called.
-; Uncomment the next line to use the built in SETF mechanism.
-;#+cmu (pushnew :setf *features*)
-) ; EVAL-WHEN
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
-
-#-setf
-(defvar *setf-function-names* (make-hash-table :size 200 :test 'eq))
-
-(defun get-setf-function-name (name)
- #+setf `(setf ,name)
- #-setf
- (or (gethash name *setf-function-names*)
- (setf (gethash name *setf-function-names*)
- (let ((pkg (symbol-package name)))
- (if pkg
- (intern (format nil
- "SETF ~A ~A"
- (package-name pkg)
- (symbol-name name))
- *pcl-package*)
- (make-symbol (format nil "SETF ~A" (symbol-name name))))))))
-
-;;; Call this to define a setf macro for a function with the same behavior as
-;;; specified by the SETF function cleanup proposal. Specifically, this will
-;;; cause: (SETF (FOO a b) x) to expand to (|SETF FOO| x a b).
-;;;
-;;; do-standard-defsetf A macro interface for use at top level
-;;; in files. Unfortunately, users may
-;;; have to use this for a while.
-;;;
-;;; do-standard-defsetfs-for-defclass A special version called by defclass.
-;;;
-;;; do-standard-defsetf-1 A functional interface called by the
-;;; above, defmethod and defgeneric.
-;;; Since this is all a crock anyways,
-;;; users are free to call this as well.
-;;;
-;;; FIXME: Once we fix up SETF, a lot of stuff around here should evaporate.
-(defmacro do-standard-defsetf (&rest function-names)
- `(eval-when (:compile-toplevel :load-toplevel :execute)
- (dolist (fn-name ',function-names) (do-standard-defsetf-1 fn-name))))
-
-(defun do-standard-defsetfs-for-defclass (accessors)
- (dolist (name accessors) (do-standard-defsetf-1 name)))
-
-(defun do-standard-defsetf-1 (function-name)
- #+setf
- (declare (ignore function-name))
- #+setf nil
- #-setf
- (unless (and (setfboundp function-name)
- (get function-name 'standard-setf))
- (setf (get function-name 'standard-setf) t)
- (let* ((setf-function-name (get-setf-function-name function-name)))
- (eval `(defsetf ,function-name (&rest accessor-args) (new-value)
- (let* ((bindings (mapcar #'(lambda (x) `(,(gensym) ,x)) accessor-args))
- (vars (mapcar #'car bindings)))
- `(let ,bindings
- (,',setf-function-name ,new-value ,@vars))))))))
-
-(defun setfboundp (symbol)
- (fboundp `(setf ,symbol)))
-
-) ; EVAL-WHEN
-
-;;; PCL, like user code, must endure the fact that we don't have a
-;;; properly working SETF. Many things work because they get mentioned
-;;; by a DEFCLASS or DEFMETHOD before they are used, but others have
-;;; to be done by hand.
-;;;
-;;; FIXME: We don't have to do this stuff any more, do we?
-(do-standard-defsetf
- class-wrapper ;***
- generic-function-name
- method-function-plist
- method-function-get
- plist-value
- object-plist
- gdefinition
- slot-value-using-class)