While futzing about with namespaces I managed to get my REPL borked enough to require a complete restart; every single thing, even bare integers, punched into it threw exceptions. I did some digging and found that this behavior differs from fairly official documentation, as follows.
Practical Clojure has this example involving building a new namespace from the ground up: user=> (in-ns 'greetings) #<Namespace greetings> greetings=> (println "Hello, World!") java.lang.Exception: Unable to resolve symbol: println in this context greetings=> (clojure.core/println "Hello, World!") Hello, World! nil It goes on to call (clojure.core/refer 'clojure.core) to get the basic clojure functions available without explicitly qualifying all the symbols. Their example does not actually work: user=> (in-ns 'greetings) #<Namespace greetings> greetings=> (println "Hello, World!") #<CompilerException java.lang.Exception: Unable to resolve symbol: eval in this context (NO_SOURCE_FILE:4)> greetings=> (clojure.core/println "Hello, World!") #<CompilerException java.lang.Exception: Unable to resolve symbol: eval in this context (NO_SOURCE_FILE:5)> nil Even an integer won't work, and the REPL must be restarted, since in-ns also won't work so you can't get back: greetings=> 42 #<CompilerException java.lang.Exception: Unable to resolve symbol: eval in this context (NO_SOURCE_FILE:5)> greetings=> (clojure.core/in-ns 'user) #<CompilerException java.lang.Exception: Unable to resolve symbol: eval in this context (NO_SOURCE_FILE:5)> So far it seems as if the REPL is attempting to look up 'eval in the current namespace instead of using 'clojure.core/eval (or even just having the eval *function object itself* held in a reference somewhere). This seems to confirm that: user=> (ns greetings2 (:refer-clojure :exclude (eval))) nil greetings2=> 42 #<CompilerException java.lang.Exception: Unable to resolve symbol: eval in this context (NO_SOURCE_FILE:9)> greetings2=> And this clinches it: user=> (def foo (create-ns 'foo)) #'user/foo user=> (intern foo 'eval (fn [form] (println "My eval!") (clojure.core/eval form))) #'foo/eval user=> (doseq [[sym vr] (ns-publics (find-ns 'clojure.core))] (if-not (= sym 'eval) (.refer foo sym vr))) nil user=> (in-ns 'foo) #<Namespace foo> foo=> 42 My eval! 42 foo=> Smells like a bug to me. But it's possible it's in Enclojure 1.4.0 rather than Clojure 1.2, if the former is providing its own REPL implementation. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en