about summary refs log tree commit diff stats
path: root/cutil.lisp
blob: 6b3f381709bfa6bb8c025b512f7fe0c49e2ab629 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(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")