From ...
Path: supernews.google.com!sn-xit-02!supernews.com!news-x.support.nl!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feed.news.nacamar.de!uio.no!Norway.EU.net!127.0.0.1!nobody
From: Erik Naggum
Newsgroups: comp.lang.lisp
Subject: Re: Allocating on the stack and *only* on the stack
Date: 13 Dec 2000 17:35:39 +0000
Organization: Naggum Software; vox: +47 800 35477; gsm: +47 93 256 360; fax: +47 93 270 868; http://naggum.no; http://naggum.net
Lines: 32
Message-ID: <3185717739569274@naggum.net>
References: <3185549145249958@naggum.net> <3185621647787532@naggum.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: oslo-nntp.eunet.no 976731421 13005 195.0.192.66 (13 Dec 2000 18:17:01 GMT)
X-Complaints-To: newsmaster@eunet.no
NNTP-Posting-Date: 13 Dec 2000 18:17:01 GMT
mail-copies-to: never
User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7
Xref: supernews.google.com comp.lang.lisp:5213
* Knut Arild Erstad
| I know that closing files is often used as an example of finalization,
| and this makes some sense: if a file descriptor object is being GCed
| while the file is still open, of course you should close it before the
| object is lost. But IMO it is bad style to wait for the GC to close
| files, in fact I would want the finalizer to issue a warning if it has
| to close the file.
I think all (scarce) resources should have finalizers associated with
their allocation request, and that having to relinquish them in the
finalization code should cause a warning, preferably with a clue as to
when and where the resource was requested. This both for safety and
debugging purposes.
The main reason not to use finalization for scarce resources, and files
are a very good example, is that you circumvent error handling in case
anything goes seriously wrong. File systems are known to run full no
matter how big they are. Network connections may disappear under your
feet. Et cetera. Interactive intervention with hung threads or even
processes may cause unwind clauses not to be run, and it is unlikely that
what failed to complete will fare any better in the finalization code.
This leads me to believe that the finalization code should be system-
supplied and written to protect the integrity of the system more than
the application that failed to protect itself, leading to the obvious
conclusion that really important resources need system support, with all
the attendant machinery. This is probably not a new idea, so I'm heading
for the Lisp machine manuals ...
#:Erik
--
The United States of America, soon a Bush league world power. Yeee-haw!