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