variable scope in an event handler

2008-12-27 Thread what-a-guy
Here's some code that works as I expected: dyn.clj (println *value*) test.clj (def *value* 'ok) (defn test-eval [] (load-file dyn.clj)) (test-eval) = 'ok But when run in an event handler it fails: test.clj (import '(javax.swing JButton JFrame)

Re: variable scope in an event handler

2008-12-27 Thread .Bill Smith
I suggest you start by comparing the current namespace in your actionPerformed method with that of *value*. Perhaps they are different. Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: variable scope in an event handler

2008-12-27 Thread Timothy Pratley
Ah thanks Bill well that would explain it! I added (println DYN: *ns*) to dyn.clj and (println DEF: *ns*) to def.clj and this is what I get: From the command line: C:\javaclj def.clj DEF: #Namespace clojure.core DYN: #Namespace clojure.core ok both are in the same namespace From the REPL:

Re: variable scope in an event handler

2008-12-27 Thread .Bill Smith
... in any case explicitly setting *ns* works, and really who uses eval/load-file like this?? Agreed. Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to