[Openmcl-devel] edit-definition for slot accessors

Takehiko Abe keke at gol.com
Fri Mar 23 11:40:00 UTC 2007


Slot accessors does not seem to be recorded into ccl::%source-files% .
meta-dot does not work for them.

ensure-class-for-defclass has this comments:

;; Maybe record source-file information for accessors as well
;; We should probably record them as "accessors of the class", since
;; there won't be any other explicit defining form associated with
;; them.

Here's my take:

(let ((*warn-if-redefine* nil)
      (*warn-if-redefine-kernel* nil))

(defun ensure-class-for-defclass (name &rest keys &key &allow-other-keys)
  (record-source-file name 'class)
  ;; Maybe record source-file information for accessors as well
  ;; We should probably record them as "accessors of the class", since
  ;; there won't be any other explicit defining form associated with
  ;; them.
  ;; ***
  (let ((slots (getf keys :direct-slots)))
    (dolist (slot slots)
      (dolist (reader (getf slot :readers))
        (record-source-file reader 'accessor))
      (dolist (writer (getf slot :writers))
        (unless (consp writer)
          (record-source-file writer 'accessor)))))
  
  (let* ((existing-class (find-class name nil)))
    (when (and *defclass-redefines-improperly-named-classes-pedantically* 
               existing-class 
              (not (eq (class-name existing-class) name)))
      ;; Class isn't properly named; act like it didn't exist
      (setq existing-class nil))
    (apply #'ensure-class-using-class existing-class name keys)))
)





More information about the Openmcl-devel mailing list