Re: compile dynamic ns ?
Stuart Sierra writes: > Clojure doesn't currently support generating Java classes dynamically, > but you could hack the compiler to allow it. And if you don't feel like doing it yourself, check out shady and `shady.gen-class/gen-class`: https://github.com/llasram/shady/blob/master/src/shady/gen_class.clj#L25 -Marshall -- 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
Re: compile dynamic ns ?
Hi Olle, gen-class only operates when *compile-files* is true, which happens when you call `compile`, which in turn calls `require`, which looks for .clj files on disk. Clojure doesn't currently support generating Java classes dynamically, but you could hack the compiler to allow it. -Stuart Sierra -- 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
compile dynamic ns ?
Hi, I want to create and compile java classes on the fly using clojure. I also want to pack the compiled result in a jar file to be used by another system. I have used JavaAssist before but thought that it could be kind of neat to use clojure instead. I have ran into a problem though: (defn dyn-class [ns cname] (gen-class :name cname :state state :main false :prefix "-" :impl-ns ns :methods [[helloGen [] void]]) (intern ns '-helloGen (fn [] (println "hello awkward world!" (create-ns 'hejsan) (dyn-class 'hejsan "com.dr.Allan") (compile 'hejsan) Could not locate hejsan__init.class or hejsan.clj on classpath: [Thrown class java.io.FileNotFoundException] Can I do this without having to write hejsan.clj down to disk ? Thanks! // Olle -- 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