Subject: Re: CLOSE and OUTPUT-STREAM-P
From: Erik Naggum <erik@naggum.net>
Date: Mon, 01 Apr 2002 22:09:40 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3226687795601675@naggum.net>

* Duane Rettig <duane@franz.com>
| But what does it actually mean to "reopen" a stream?

  To use the information that a stream known about itself to open the same
  source again in precisely the same way it was first opened.  If this were
  not possible, one would have to associate the stream with some hash table
  or something else that keeps this information around, but there is no way
  to make a stream point back to such information, so if you have to do
  these things, it creates a hairy information maintenance and consistency
  problem.  E.g., a stream, even a closed stream, is a pathname designator.

  I do not mean to "reuse" the streams object, although it would be very
  convenient if open could take an open stream and return a clone or a
  closed stream and return a new open stream to the same object insofar as
  that be possible.

| If the file is external and in fact externally changeable, there may be
| no way to reestablish a connection that looks the same as the one
| previously established.

  But this may be intentional, like a file-position back to the beginning
  of the file may cause subsequent read-char calls to return different
  values than last time because the file has been independently modified.

| I am not arguing against saving as much information as possible for the
| subsequent reopening of a stream if possible, but I am warning that such
| reopening might not be possible.

  Well, you have no guarantee that you can read the data that was in the
  file at the time it was opened, either.  One needs to be aware of such
  things when dealing with the hostile external world.  I am not arguing
  for a change to the universe in order to get a desired feature.

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.