Re: Strange behaviour of *standard-output* in sbcl
- From: Joshua Taylor <joshuaaaron@xxxxxxxxx>
- Date: Wed, 30 Jul 2008 11:21:30 -0700 (PDT)
On Jul 30, 1:39 pm, Richard M Kreuter <kreu...@xxxxxxxxx> wrote:
Joshua Taylor <joshuaaa...@xxxxxxxxx> writes:
The Hyperspec says about WITH-OPEN-FILE, "with-open-file uses open
to create a file stream to file named by filespec. Filespec is the
name of the file to be opened. Options are used as keyword arguments
to open." From an issue write (about dynamic extent, not directly
relevant here), "[WITH-OPEN-FILE] probably should inherit whatever
restrictions are placed on WITH-OPEN-STREAM, so you can implement it
that way."
This suggests that WITH-OPEN-FILE could be implemented as
(defmacro with-open-file2 ((var filename &rest options) &body body)
`(with-open-stream (,var (open ,filename ,@options))
,@body))
Not necessarily. WITH-OPEN-FILE has an extra requirement:
| If a new output file is being written, and control leaves
| abnormally, the file is aborted and the file system is left, so far
| as possible, as if the file had never been opened.
I don't see anything in WITH-OPEN-STREAM to suggest that it's supposed
to do anything interesting in case of abnormal transfer out of the
body.
Ah, good catch. So we have at least two cases for WITH-OPEN-STREAM,
one of which is when the stream isn't one easily produced by OPEN, and
another which is when the stream can be created by OPEN, but if
something happens in the middle, the file should still be present
afterward. Have we got any more cases?
//JT
.
- References:
- Strange behaviour of *standard-output* in sbcl
- From: Haiwei
- Re: Strange behaviour of *standard-output* in sbcl
- From: Pascal J. Bourguignon
- Re: Strange behaviour of *standard-output* in sbcl
- From: Haiwei
- Re: Strange behaviour of *standard-output* in sbcl
- From: Joshua Taylor
- Re: Strange behaviour of *standard-output* in sbcl
- From: Richard M Kreuter
- Strange behaviour of *standard-output* in sbcl
- Prev by Date: Re: Strange behaviour of *standard-output* in sbcl
- Next by Date: Re: fftw bindings? (Fourier Transform Library)
- Previous by thread: Re: Strange behaviour of *standard-output* in sbcl
- Next by thread: Re: Strange behaviour of *standard-output* in sbcl
- Index(es):
Relevant Pages
|