 (defn make-reaction [f & {:keys [auto-run on-set on-dispose]}]
   (let [runner (if (= auto-run true) run auto-run)]
     (Reaction. f nil true false
-               #{} {}
+               nil {}
                runner on-set on-dispose)))

  IRunnable
  (run [this]
    (let [oldstate state
          [res derefed] (capture-derefed f)]
      (when (not= derefed watching)
        (-update-watching this derefed))
      (when-not active?


(defn running [] @-running)

(defn- capture-derefed [f obj]
  (set! (.-captured obj) nil)
  (binding [*ratom-context* obj]
    (f)))

(defn- notify-deref-watcher! [derefable]
  (let [obj *ratom-context*]
    (when-not (nil? obj)
      (let [captured (.-captured obj)]
        (set! (.-captured obj)
              (conj (if (nil? captured) #{} captured)
                    derefable))))))

(deftype RAtom [state meta validator watches]
  IEquiv
