0d44e5e6 |
(defpackage :mfa-tool.store
(:use :cl)
|
2b35742e |
(:export #:store #:execute #:dispatch
#:next-store
#:next-store-p
|
fdb888c8 |
#:propagate
#:recording-store
#:record))
|
0d44e5e6 |
(in-package :mfa-tool.store)
(defclass store ()
|
2b35742e |
((%next-store :initarg :next-store :reader next-store)))
(defun next-store-p (store)
(slot-boundp store '%next-store))
|
0d44e5e6 |
|
fdb888c8 |
(fw.lu:defclass+ recording-store ()
((%record :reader record :accessor %record :initform ())))
|
0d44e5e6 |
(defgeneric execute (store action)
(:argument-precedence-order action store)
(:method :around (store action)
|
2b35742e |
(call-next-method)
store)
|
0d44e5e6 |
(:method (store action)
|
2b35742e |
store))
|
0d44e5e6 |
(defgeneric dispatch (store action)
(:argument-precedence-order action store)
(:method ((store store) action)
|
2b35742e |
(execute store action))
(:method ((store symbol) action)
(execute store action)))
(defun propagate (store action)
(when (next-store-p store)
(dispatch (next-store store)
action))
store)
|
fdb888c8 |
(defmethod dispatch :before ((store recording-store) action)
(push action
(%record store)))
|