[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: metaclasses

  Date: Thu, 10 Aug 89 14:49 U
  From: CHEEWEEI%ITIVAX.BITNET@cunyvm.cuny.edu
  MMDF-Warning:  Parse error in original version of preceding line at DINO.BBN.COM
  Subject:  metaclasses
  To: commonloops.pa@xerox.com
  X-Original-To:  commonloops.pa@xerox.com, CHEEWEEI
  Message-Id: <890809-235233-6074@Xerox>
  In defining a metaclass eg.
  (defclass my-standard-class (standard-class)
  I also have to define:
  (defmethod check-super-metaclass-compatibility ((x my-standard-class) (y t)) 't)
  Is this something that must be done now as well as in future for user
  defined metaclasses?
  Is the decision when classes and methods are compiled totally left up to
  the CLOS implementation? Is there a similar function like
  compile-flavor-methods in Flavors that ensures it?

This is what we use:

(defvar *compile-class-hash* (make-hash-table :test #'eq))

(defun COMPILE-CLASS-METHODS-1 (classes)
  (clrhash *compile-class-hash*)
  (dolist (class-spec classes)
    (let ((class (cond ((symbolp class-spec) (find-class class-spec nil))
		       ((classp class-spec) class-spec))))
      (cond (class
	     (dolist (gf (class-direct-generic-functions class))
	       (unless (gethash gf *compile-class-hash*)
		 (setf (gethash gf *compile-class-hash*) T)
		 (notice-methods-change-1 gf))))
	    (t (warn "~A is neither a class nor the name of a class" class-spec))))))

(defmacro COMPILE-CLASS-METHODS (&rest classes)
  `(compile-class-methods-1 ',classes))