Hello, I just started writing my first non-toy clojure program and I'm curious how people handle global resources without component (or component like) systems. I plan to make use of component but I'm trying to add new concepts one by one.
As an example I have a scheduler (quartzile): (def scheduler (qs/intialize)) (defn -main [& args] (qs/start scheduler)) So this works and I can access the scheduler instance in my REPL to poke at it while I'm developing. I then do lein uberjar and it won't compile :). The compiler is executing the qs/initialize function which is no good. So I could move that initialize inside of main: (def -main [& args] (-> (qs/intialize) (qs/start))) But I've now lost a global reference to poke at the scheduler. Instead I used alter-var-root, which I've seen before, but until now actually had no idea what it really did... (def scheduler) (def -main [& args] (alter-var-root #'scheduler (fn [old] (qs/initialize))) (qs/start scheduler)) So this seems nasty, but lein uberjar is happy. Anyways, I'm just curious of what the alternatives are to manage this outside of a component type system (which I plan to use!). Thanks! -- 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/d/optout.