From aa5086379944401debd85e60954814acb8b661d8 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <fare@tunes.org>
Date: Fri, 20 Apr 2012 16:58:24 -0400
Subject: [PATCH] Classy interfaces, with an associated class.

---
 interface/interface.lisp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/interface/interface.lisp b/interface/interface.lisp
index e479298..5f61680 100644
--- a/interface/interface.lisp
+++ b/interface/interface.lisp
@@ -15,12 +15,14 @@
    ;;; Classes
    #:<interface>
    #:<type>
+   #:<classy>
 
    ;;; General purpose gfs
    #:check-invariant
    #:make
    #:update
    #:base-interface
+   #:instantiate
    ))
 
 (in-package :interface)
@@ -55,3 +57,15 @@ On success the OBJECT itself is returned. On failure an error is signalled."))
 
 (defgeneric base-interface (<interface>)
   (:documentation "from the parametric variant of a mixin, extract the base interface"))
+
+
+;;; Classy Interface (i.e. has some associated class)
+
+(defclass <classy> (<interface>)
+  ((class :reader interface-class :allocation :class)))
+
+(defgeneric instantiate (<interface> &key &allow-other-keys))
+
+(defmethod instantiate ((i <classy>) &rest keys &key &allow-other-keys)
+  (apply 'make-instance (interface-class i) keys))
+
-- 
GitLab