Subject: Re: conservative gc sucks
From: Erik Naggum <>
Date: 10 Jan 2003 11:58:02 +0000
Newsgroups: comp.lang.lisp
Message-ID: <>

* (Tom Lord)
| Ok, but, so what?  The topic is closing _files_, not streams.  Files
| may be randomly accessible.  Reaching the end-of-file during a read 
| is not a condition under which to automatically close the file.

  I thought you said this was obvious, but it appears that you were
  not entirely truthful.

  If you want freedom from closing/freeing a /stream/, the obvious
  solution is to close it when it has been exhausted.  This is neatly
  localizable and abstractable.

  If you want to refer to /files/, the obvious solution is to intern
  pathnames and use a mechanism that keeps a maximum number of files
  open which is used to close the least recently referenced file if
  you are maxed out, so you save on the open calls.  If you close a
  file, you can keep its file-position with this structure for use if
  you need to open it again.  In this scheme, you never really talk to
  any streams -- they are hidden by the abstraction, and hence open
  and close are localized operations.

  Your argument was that certain algorithms were not implementable in
  Common Lisp because the language did not require the closing of
  operating-system files when the system garbage-collected streams.
  This is in fact wrong.  There are far more possibilities that you
  have been willing to explore before you reached your conclusion.

Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.