[iterate-devel] in-stream closes stream at the end: bad idea?

daniel radetsky dradetsky at gmail.com
Wed Oct 22 21:05:41 UTC 2008


On Tue, Oct 21, 2008 at 9:15 PM, Kalyanov Dmitry
<kalyanov.dmitry at gmail.com> wrote:
> stream closing should be done also in case of stack unwinding.

Right, and it will be done if I write, e.g.

(with-open-file (stream ... )
  (iter (for x in-stream stream)
         (foo x)))

> that stream might be created by in-place.
>
> My idea is of something like this:
> (iter (for x in-stream (open-file .....) close-stream t))

Iterate already has a mechanism for this: the in-file driver, which
already does (and should) close the stream.

The point is, when you pass a stream to the driver, iterate doesn't
know what the stream is, what you want to do with it, or anything. Why
should it close the stream, especially when streams are generally
created inside UNWIND-PROTECT-based macros?




More information about the iterate-devel mailing list