Variable scope + eval in Clojure
问题 In Clojure, (def x 3) (eval \'(prn x)) prints 3, whereas (let [y 3] (eval \'(prn y))) and (binding [z 3] (eval \'(prn z))) generate an \'Unable to resolve var\' exception. According to http://clojure.org/evaluation, eval , load-string , etc generate temporary namespaces to evaluate their contents. Therefore, I\'d expect neither of the above code samples to work, since (def x 3) is done in my current namespace, not the one created by eval . Why does the first code sample work and not the last