Permalink
Browse files

Clarify documentation to reflect importance of using Var objects.

  • Loading branch information...
1 parent 01eb2e8 commit d7e96cbfdea70b92083cd7094484f253c397edde Paul Dorman committed Jan 15, 2012
Showing with 17 additions and 6 deletions.
  1. +14 −3 README.md
  2. +3 −3 src/robert/hooke.clj
View
@@ -48,9 +48,9 @@ Hooke is inspired by Emacs Lisp's defadvice and clojure.test fixtures.
(defn telescope [f x]
(f (apply str (interpose " " x))))
- (add-hook #'examine microscope)
- (add-hook #'examine doubler)
- (add-hook #'examine telescope)
+ (add-hook #'examine #'microscope)
+ (add-hook #'examine #'doubler)
+ (add-hook #'examine #'telescope)
(examine "something")
> S O M E T H I N G
@@ -73,6 +73,17 @@ impossible to add further methods. Hooks are meant to extend functions
you don't control; if you own the target function there are obviously
better ways to change its behaviour.
+When adding hooks be sure to use Var objects for both to ensure
+consistency between what you get in your REPL and your compiled code,
+i.e.:
+
+ (add-hook #'some.ns/target-var #'hook-function)
+
+instead of:
+
+ (add-hook #'some.ns/target-var hook-function)
+
+
## Bonus Features
Most of the time you'll never need more than just add-hook. But
View
@@ -17,9 +17,9 @@
(defn telescope [f x]
(f (apply str (interpose \" \" x))))
- (add-hook #'examine microscope)
- (add-hook #'examine doubler)
- (add-hook #'examine telescope)
+ (add-hook #'examine #'microscope)
+ (add-hook #'examine #'doubler)
+ (add-hook #'examine #'telescope)
;; Now when we examine something:
(examine \"something\")

0 comments on commit d7e96cb

Please sign in to comment.