diff options
author | Stuart Halloway <stu@thinkrelevance.com> | 2009-12-30 13:09:51 -0500 |
---|---|---|
committer | Stuart Halloway <stu@thinkrelevance.com> | 2009-12-30 13:09:51 -0500 |
commit | f24f6412a1cee7015285856e5e4fc6ddc3974439 (patch) | |
tree | 6c54832dc5f72866f58b8010ef0c5cdbf451c11a /src/clojure/contrib/with_ns.clj | |
parent | 3764e2e6a5b135b44c0b5971ad16c4eb230b2eba (diff) |
clean up temporary namespaces, fixes #54
Diffstat (limited to 'src/clojure/contrib/with_ns.clj')
-rw-r--r-- | src/clojure/contrib/with_ns.clj | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/clojure/contrib/with_ns.clj b/src/clojure/contrib/with_ns.clj index be33dd7c..d874a4a5 100644 --- a/src/clojure/contrib/with_ns.clj +++ b/src/clojure/contrib/with_ns.clj @@ -29,9 +29,10 @@ "Evaluates body in an anonymous namespace, which is then immediately removed. The temporary namespace will 'refer' clojure.core." [& body] - `(do (create-ns 'sym#) - (let [result# (with-ns 'sym# - (clojure.core/refer-clojure) - ~@body)] - (remove-ns 'sym#) - result#))) + `(try + (create-ns 'sym#) + (let [result# (with-ns 'sym# + (clojure.core/refer-clojure) + ~@body)] + result#) + (finally (remove-ns 'sym#)))) |