"Meikel Brandmeyer (kotarak)" <m...@kotka.de> writes: > don't get me wrong: I don't want to discuss away your use case! But I don't > understand it, yet. After your calling intern, do you compile other code > referencing the created Vars? If no: why do you need Vars? If yes: why > don't you just generate code with a def and compile it?
So, I have build a library which allows me to generate logic statements, which can then be computing over. So: (defclass A) (defclass B :subclass A) which means, all instances of B are also instances of A. defclass is implemented with a macro which underneath expands to a def form. The vars in this case (A and B) hold Java objects representating these statements. These statements can be saved in an XML representation called OWL, which is a W3C standard. Most of the people generating OWL files are not using my library; so I need to be able to read these OWL files and interact with them in manner which is similar to if I had written them with my library. So I parse the XML file, generate some Java objects, then use intern to generate vars. So, now I can refer to an OWL file in exactly the same way as if it were written in Clojure. All of this works, except for the problems I have had with testing I cannot load vars on the fly. I have a related problem when I want to test a renderer that I have written which generates clojure code (again, representing logical statements). After rendering the Clojure, I then run a require the rendered code. Nice idea, but fails -- you can see an exemplar of the problem here: user=> clojure.set/difference CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0) user=> (do (require 'clojure.set) clojure.set/difference) #<set$difference clojure.set$difference@6ee76fcc> (restart repl) user=> clojure.set/difference CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0) user=> (try (require 'clojure.set) clojure.set/difference) CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:2:1) In the end, my work around was equivalent to this... (try (require 'clojure.set) (eval 'clojure.set/difference)) #<set$difference clojure.set$difference@63ae6098> Tell me if all this is making you feel queasy. In either circumstance, the code *should* run, although I understand why it does not. This strong separation of undynamic compilation and a dynamic eval seems unnatural to me. Anyway, I do have a work-arounds to be going on with, and I suspect that it's not going to change because it's depths of clojure stuff. Phil -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.