blob: 6b3f381709bfa6bb8c025b512f7fe0c49e2ab629 (
plain) (
tree)
|
|
(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")
|