                                  `(fn [x#] (x#)))
                               th#)))
               ~initial-value
-              (deref extend-thunks#)))))
+              (deref ~extend-thunks)))))
        (defn ~writer [f#]
          (when-not (~(if clojure? `var? `fn?) f#)
            (throw (ex-info

                         ~(if clojure? "var" "functions"))
                    {:invalid-value f#
                     :register-fn (quote ~writer)})))
         (swap! extend-thunks# conj f#)))))

  ;; This is a macro, so it'll always be Clojure, so we can't just use
  ;; a reader conditional, so we check `(:ns &env)`, which will be
  ;; `nil` if evaluating the macro in Clojure.
  (let [clojure? (nil? (:ns &env))
        extend-thunks (symbol (str reader "-atom"))]
    `(do
       (defonce ~extend-thunks (atom []))
       (def ~reader
         ;; Hack around protocol being clojure.lang.IDeref in Clojure vs
         ;; cljs.core/IDeref in Clojurescript and the method being
