I have some code which opens a bunch of resources (say, files), and needs to make sure they all get closed. Something like this:
(let [files (atom [])] (try (open-my-many-files files) ;; the files atom now refers to a vector of open file handles (do-dangerous-io @files) (finally (doseq [file @files] (.close file))))) The Clojure compiler does not like this: error: java.lang.UnsupportedOperationException: Cannot recur from catch/finally Does Clojure have a lower-level iteration primitive than loop and recur, which I can use inside exception handling code? I can obviously put a letfn inside the finally and use good old recursion, but I feel uncomfortable doing this without TCO. (Yes, I know I'm likely to run out of file descriptors before I run out of available stack frames, but this is still the wrong way to do things.) I would also very much prefer not to have to write and call out to Java helper classes for something as trivial as a loop. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---