Permalink
Browse files

Rename hook-scope to with-scope.

  • Loading branch information...
1 parent 76eabb5 commit 8505ae0981b833931be8cc25391b1efc2c56739e @technomancy committed Oct 26, 2012
Showing with 8 additions and 7 deletions.
  1. +3 −3 README.md
  2. +4 −3 src/robert/hooke.clj
  3. +1 −1 test/robert/test_hooke.clj
View
@@ -108,15 +108,15 @@ stripped out:
(print-name "Alan Moore"))
> Alan Moore
-The `hook-scope` macro provides a scope which records any change to hooks during
+The `with-scope` macro provides a scope which records any change to hooks during
the dynamic scope of its body, and restores hooks to their original state on
exit of the scope. Note that all threads share the scope. Using the example
functions above:
(examine "something")
> something
- (hook-scope
+ (with-scope
(add-hook #'examine #'microscope)
(examine "something"))
> SOMETHING
@@ -126,6 +126,6 @@ functions above:
## License
-Copyright © 2010-2011 Phil Hagelberg and Kevin Downey
+Copyright © 2010-2012 Phil Hagelberg and Kevin Downey
Distributed under the Eclipse Public License, the same as Clojure.
View
@@ -36,6 +36,7 @@
(defn- compose-hooks [f1 f2]
(fn [& args]
+ ;; TODO: tracing
(apply f2 f1 args)))
(defn- join-hooks [original hooks]
@@ -80,9 +81,9 @@
(doseq [[var old-hooks] head]
(reset! (hooks var) old-hooks)))))
-(defmacro hook-scope
- "Defines a scope which records any change to hooks during the dynamic scope of
-its body, and restores hooks to their original state on exit of the scope."
+(defmacro with-scope
+ "Defines a scope which records any change to hooks during the dynamic extent
+of its body, and restores hooks to their original state on exit of the scope."
[& body]
`(try
(start-scope)
@@ -86,7 +86,7 @@
(deftest hook-scope-test
(is (hooked))
- (hook-scope
+ (with-scope
(add-hook #'hooked asplode)
(is (thrown? Exception (hooked))))
(is (hooked)))

0 comments on commit 8505ae0

Please sign in to comment.