[Openmcl-devel] Closing a stream with :abort

Gary Byers gb at clozure.com
Wed Feb 27 16:08:14 PST 2008

If a file's OPENed with :IF-EXISTS :SUPERSEDE, its previous contents
are restored if it's CLOSEd with :ABORT true:

? (delete-file "home:content")
? (with-open-file (f "home:content" :direction :output :if-does-not-exist :create)
   (write-line "This content should either be overwritten or preserved" f))
"This content should either be overwritten or preserved"
? (with-open-file (f "home:content" :direction :output :if-does-not-exist :create :if-exists :supersede)
   (write-line "new content" f)
   (force-output f)
   (close f :abort t))

I think you're right that if the file was created by OPEN, closing
it with :ABORT true should try to delete it (and that doesn't happen).
I'll try to fix that soon.

On Wed, 27 Feb 2008, Osei Poku wrote:

> Hi,
> What is the standard behavior when closing a file stream with :abort
> set to T?
> Am I interpreting the hyperspec incorrectly when it states:
> "If abort is true, an attempt is made to clean up any side effects of
> having created stream. If stream performs output to a file that was
> created when the stream was created, the file is deleted and any
> previously existing file is not superseded."
> Clozure CL seems to leave the file completely intact.
> Osei
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

More information about the Openmcl-devel mailing list