robert-hooke icon indicating copy to clipboard operation
robert-hooke copied to clipboard

Why not just use `hooks` instead of `#'hooks`?

Open kindlychung opened this issue 9 years ago • 0 comments

Why not just use hooks instead of #'hooks? It's likely that the hooks function will change dynamically.

(defmacro with-hooks-disabled [f & body]
  `(do (when-not (#'hooks (var ~f))
         (throw (Exception. (str "No hooks on " ~f))))
       (with-redefs [~f (#'original (var ~f))]
         ~@body)))

kindlychung avatar May 13 '15 17:05 kindlychung