The `constraints' slot of a `sequencer' object maintains a list of
constraints, each of which is a list of `sequencer-item' objects, and
this list is ordered with the most-recently added constraint first.
Previously the :constraints initarg just set this list directly, which
isn't really very satisfactory. Instead, handle the initarg specially,
reversing it, and converting item names into the actual items, interning
them properly.
This isn't completely right, because there's no way at this time to
attach handler functions to the implicitly created items, but it's way
better than nothing.
(print-unreadable-object (item stream :type t)
(prin1 (sequencer-item-name item) stream)))
(print-unreadable-object (item stream :type t)
(prin1 (sequencer-item-name item) stream)))
+(defmethod shared-initialize ((sequencer sequencer) slot-names
+ &key (constraints nil constraintsp))
+ (call-next-method)
+ (when constraintsp
+ (setf (slot-value sequencer 'constraints)
+ (mapcar (lambda (constraint)
+ (mapcar (lambda (name)
+ (ensure-sequencer-item sequencer name))
+ constraint))
+ (reverse constraints))))
+ sequencer)
+
(defmethod ensure-sequencer-item ((sequencer sequencer) name)
(with-slots (table) sequencer
(or (gethash name table)
(defmethod ensure-sequencer-item ((sequencer sequencer) name)
(with-slots (table) sequencer
(or (gethash name table)
(export '(sequencer sequencer-constraints sequencer-table))
(defclass sequencer ()
(export '(sequencer sequencer-constraints sequencer-table))
(defclass sequencer ()
- ((constraints :initarg :constraints :initform nil
- :type list :accessor sequencer-constraints)
+ ((constraints :initform nil :type list :accessor sequencer-constraints)
(table :initform (make-hash-table :test #'equal)
:reader sequencer-table))
(:documentation
(table :initform (make-hash-table :test #'equal)
:reader sequencer-table))
(:documentation