Christophe Weblog Wiki Code Publications Music
test case!
[specializable.git] / specializable.lisp
index 6fabb2420607b828db73b9599e4724833f0e1b19..979f51476cb01d41b4709c77409b458955bdd0df 100644 (file)
 ;;;             gf
 ;;;             args))))
 
+;;; FIXME: this (and add/remove-direct-method) don't actually work
+;;; together, because two distinct calls to make-extended-specializer
+;;; return two distinct specializer objects.  We need either to make
+;;; the extended specializers be interned, or to have them be
+;;; arbitrarily ephemeral but adjust specializer-direct-methods (and
+;;; implement specializer-direct-generic-functions) accordingly.
 (defun make-extended-specializer (sname)
   (destructuring-bind (kind &rest args) sname
     (apply (or (get kind 'extended-specializer-parser)
 ;;; FIXME: in some kind of order, the discriminating function needs to handle:
 ;;; - argument count checking;
 ;;; - keyword argument validity;
-;;; - flushing the emf cache on method addition/removal
+;;; - DONE flushing the emf cache on method addition/removal
 ;;; - flushing the cache on class redefinition;
 ;;; - cache thread-safety.
 (defmethod sb-mop:compute-discriminating-function ((gf specializable-generic-function))
          (sb-pcl::invoke-emf emfun args)
          (slow-method-lookup gf args generalizers)))))
 
+(defmethod reinitialize-instance :after ((gf specializable-generic-function) &key)
+  (clrhash (emf-table gf)))
+
 (defun slow-method-lookup (gf args generalizers)
   ;; differs from closette
   (multiple-value-bind (applicable-methods definitivep)