Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

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

Open
kindlychung opened this issue May 13, 2015 · 0 comments
Open

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

kindlychung opened this issue May 13, 2015 · 0 comments

Comments

@kindlychung
Copy link

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)))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant