Christophe Weblog Wiki Code Publications Music
fix one package export
[specializable.git] / specializable.lisp
index 6fabb2420607b828db73b9599e4724833f0e1b19..2c8ebc5864c2b9a4381d1e100405471a1db64bf3 100644 (file)
@@ -8,7 +8,7 @@
   (:export "SPECIALIZABLE-GENERIC-FUNCTION" "SPECIALIZABLE-METHOD"
            "EXTENDED-SPECIALIZER"
 
-           "SPECIALIZER-ACCEPTS-P" "SPECIALIZER-ACCEPTS-CLASS-P"
+           "SPECIALIZER-ACCEPTS-P" "SPECIALIZER-ACCEPTS-GENERALIZER-P"
            "SPECIALIZER<"
 
            "GENERALIZER-OF-USING-CLASS"
 ;;;             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)