On Apr 28, 10:45 am, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > Am 28.04.2009 um 19:01 schrieb Bradbev: > > > Is it a good idea for line-seq to close its BufferedReader when there > > is no more data? Or at least provide an optional parameter that > > allows/disallows close? > > The cleanest solution with respect to lazy sequences is > realisation. > > (with-open [rdr (...)] > (doall (line-seq rdr)))
Not very lazy though is it? :) > > Closing the reader when reaching the end of the seq > doesn't help, since maybe you never reach the end of > the seq? So passing the seq outside of your responsibility > means realising it and closing the reader, eg. via the > code above. Wouldn't the finalizer for the BufferedReader call close in that case? Not really ideal though I guess. > > If the seq doesn't leave your area of responsibility you > can consume the seq and close the reader explicitely. > > At least this is my understanding of the current situation. > > (Note: this also applies to db connections and such...) > > Sincerely > Meikel > > smime.p7s > 5KViewDownload --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---