about summary refs log blame commit diff stats
path: root/cutil.lisp
blob: 6b3f381709bfa6bb8c025b512f7fe0c49e2ab629 (plain) (tree)
1
2
3
4
5
6
7
8
9
                   
                      
          

                     

                    
                                               
                                                       
                                                                   



                                                           
                                                                   



                                                                          
    
 


                          
                 
(defpackage #:cutil
  (:use #:common-lisp)
  (:export
   #:<abstract-class>
   #:instancep))
(in-package #:cutil)

(defclass <abstract-class> (standard-class) ())
(defmethod make-instance ((self <abstract-class>) &key)
  (error "Cannot instantiate abstract class ~A" (class-name self)))

;;; These are copied from cl-abstract-classes in Quicklisp.
;;; It turns out you do need both.
;;; Maybe someday I'll understand why :-)
(defmethod closer-mop:validate-superclass ((class <abstract-class>)
					   (superclass cl:standard-class))
  t)
(defmethod closer-mop:validate-superclass ((class cl:standard-class)
					   (superclass <abstract-class>))
  t)

(defun instancep (obj cls)
  (eq (class-of obj) cls))

(provide "cutil")