       (remove-watch w this))
     (set! watching nil)
     (set! state nil)
-    (set! dirty? true)
+    (set! dirty? is-dirty)
     (when active?
       (when debug (swap! -running dec))
       (set! active? false))

    (if (or auto-run (some? *ratom-context*))
      (do
        (notify-deref-watcher! this)
        (if dirty?
          (run this)
          state))
      (do
        (when dirty?
          (let [oldstate state]
            (set! state (f))
            (when-not (identical? oldstate state)

  (-handle-change [k sender oldval newval])
  (-peek-at [this]))

(def clean 0)
(def maybe-dirty 1)
(def is-dirty 2)

(deftype Reaction [f ^:mutable state ^:mutable dirty? ^:mutable active?
                   ^:mutable watching ^:mutable watches
                   auto-run on-set on-dispose]
