Stuart, Thanks for the link. It confirms the suspicions I had about a general solution for this issue. For the particular code I'm working with, I'll try pushing with-open further up and see if that gives me some of the flexibility I'm looking for.
Cheers, Dave On Sun, Oct 28, 2012 at 2:21 PM, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > On Friday, October 26, 2012 11:11:48 PM UTC-4, daveray wrote: >> >> I guess I looking for a magical line-seq that closes the file correctly >> even if you consume part of the sequence, is resilient to exceptions, >> etc, etc. I realize that it might be impossible, so I asked. :) > > > It's been discussed extensively in the past, but no one has come up with a > solution that adequately solves the general problem. See > http://dev.clojure.org/display/design/Resource+Scopes for examples of some > attempts. > > The best approach I've found is to manage resources like files farther up > the stack. Instead of having a 'with-open' block that returns a sequence, > put the 'with-open' block at a higher level, so that it encompasses the > entire scope in which the file will be used. > > -S > > -- > 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 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