A system including a few common OOP Patterns.
abstract-class
singleton-class
(defclass db ()
((person-table :initform (make-hash-table))
(job-table :initform (make-hash-table)))
(:metaclass singleton-class))
;; whenever you need to acces your DB you can instantiate the DB class:
(run-query (make-instance 'db) my-query)
;; This works (though is perhaps a little goofy) because
(eq (make-instance 'db) (make-instance 'db))
;; will always return T
(defclass aristotelian-espresso ()
((grind :initarg :grind)
(roast :initarg :roast))
(:metaclass abstract-class))
(make-instance 'aristotelian-espresso
:grind :moderate
:roast :moderate)
;; Abstract class ARISTOTELIAN-ESPRESSO cannot be instantiated
;; [Condition of type SIMPLE-ERROR]
This is a duplicate of a subset of of the functionality exposed in
tfeb-lis-hax. We reimplement
it here because tfeb
's library makes a decision to lazy load the
closer-mop
system dependency in a way that does not agree with the
build process of quilc and
qvm. See this
issue for context.