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)))

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.

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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to