Permalink
Browse files

Merge pull request #5 from pauldorman/d7e96cbfdea70b92083cd7094484f25…

…3c397edde

Clarify documentation to reflect importance of using Var objects.
  • Loading branch information...
2 parents 01eb2e8 + d7e96cb commit d2a01a45b81447e6e74b7b459598cdbe82d9981c @technomancy committed Jan 16, 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 d2a01a4

Please sign in to comment.