anchor.diff:  ;; Generics
   (defgeneric emit (emitter event &rest args)
     (:documentation "Emit `event' on the `emitter', invoking callbacks, if any, with `args'"))
  +(defgeneric deliver (emitter event args)
  +  (:documentation "Queue the invocation of callbacks for the `event' event with `args'"))
   
   (defgeneric add-listener (emitter event callback)
     (:documentation "Add a listener to `emitter' so when `event'
  
positive.code:   (:documentation "remove either all listeners on `emitter' or just those bound to `event' if given."))
  
  ;; Methods
  (defmethod emit ((emitter emitter) (event string) &rest args)
    "Enqueue the delivery of an `event' with `args'. The event will
  be delivered at some point in the future, but very soon, in the order
  that it was emitted relative to other events."
    (let ((registered (gethash event (listeners emitter))))
      (flet ((deliver (cb)
               (when (remhash cb (oneshots emitter))
                 (remove-listener emitter event cb))
               (enqueue (events emitter) (lambda () (apply cb args)))))
        (mapc #'deliver registered))))
  
  (defmethod emit :after ((emitter emitter) (event string) &rest args)
    "Register an interval to deliver the emitted events as they are fired
  in the order that they are fired. When the queue is empty the delivery
  timer goes to sleep until the next event is emitted."
    (declare (ignore args))
    (flet ((emitter-cb (&rest _)
             (declare (ignore _))
             (if-let (thunk (dequeue (events emitter)))
               (funcall thunk)
               (ev:stop-watcher (owner emitter) (event-runner emitter) :keep-callback t))))
  
      (unless (event-runner emitter)
        (setf (event-runner emitter) (let ((watcher (make-instance 'ev:ev-idle)))
                                       (prog1 watcher
                                         (ev:set-idle (owner emitter) watcher #'emitter-cb)))))
  
      (ev:start-watcher (owner emitter) (event-runner emitter))))
  
  (defmethod add-listener ((emitter emitter) (event string) (callback symbol))
    (add-listener emitter event (symbol-function callback)))
  
negative.code:           :documentation "The hinge instance the event emitter functions within.")
  
     (oneshots :accessor oneshots)
     (listeners :accessor listeners)))
  
  (defgeneric reset (emitter)
    (:documentation "Reset the emitter to its empty initial state.")
  