Permalink
Browse files

unify-gensyms should only unify on double hash symbols

  • Loading branch information...
1 parent 0052b99 commit f64103d7bb296aec4b1ce7aba94ab0033d6267b2 @ztellman committed Feb 1, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/potemkin/macros.clj
View
@@ -9,7 +9,7 @@
(ns potemkin.macros
(:use [clojure walk]))
-(def gensym-regex #"([a-zA-Z\-]+)__\d+__auto__$")
+(def gensym-regex #"([a-zA-Z\-]+)#__\d+__auto__$")
(defn gensym? [s]
(and
@@ -19,7 +19,10 @@
(defn un-gensym [s]
(second (re-find gensym-regex (str s))))
-(defn unify-gensyms [body]
+(defn unify-gensyms
+ "All gensyms defined using two hash symbols are unified to the same
+ value, even if they were defined within different syntax-quote scopes."
+ [body]
(let [gensym* (memoize gensym)]
(postwalk
#(if (gensym? %)

0 comments on commit f64103d

Please sign in to comment.