I would like to connect to MongoDb with the following code, but I am worried about the side-effecting code that comes right after the dosync:
(def which-database-to-use (ref false)) (def which-collection-to-use (ref false)) (defn connect-to-server [] (mg/connect!)) (defn set-database-to-use [] (mg/set-db! (mg/get-db @which-database-to-use))) (defn establish-database-connection [database-name-as-string collection-name-as-string] (dosync (ref-set which-database-to-use database-name-as-string) (ref-set which-collection-to-use collection-name-as-string)) (when @which-database-to-use (connect-to-server) (set-database-to-use))) Is there a risk that set-database-to-use will be called before the dosync is finished? -- -- 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.