On Wednesday 21 April 2010 15:06:40 ka wrote: Hi!
> The macro solution looks good. But with 2 different APIs for 2 > connections, I would need to write 2 macros right? No, not really. You could also make the symbols for the API class an additional arg to the macro, like: (defmacro with-api-connection [conn-sym api arg1 arg2 & body] `(let [~conn-sym (. ~api getConnection ~arg1 ~arg2)] (try ~...@body (finally (. ~api closeConnection ~conn-sym))))) but then the macre application would be longer. (with-api-connection [c API1 "localhost" 12345] (with-api-connection [c2 API2 "141.55.22.1" 13321] (do-stuff-with c c2)) (do-stuff-with c)) Bye, Tassilo -- 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