From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: Trigger action at exit? Date: Tue, 04 Mar 2008 11:25:50 +0100 Message-ID: <874pbm3hw1.fsf@gnu.org> References: <68dbb6fe0802291430g42240937u1241348a85021e73@mail.gmail.com> <87ve459gxb.fsf@gnu.org> <87hcfna66r.fsf@ossau.uklinux.net> <87ve434gqj.fsf@gnu.org> <87d4qba1vs.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204626534 14761 80.91.229.12 (4 Mar 2008 10:28:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Mar 2008 10:28:54 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Mar 04 11:29:18 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JWUOa-0007n8-QK for guile-user@m.gmane.org; Tue, 04 Mar 2008 11:29:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWUO3-00045e-GV for guile-user@m.gmane.org; Tue, 04 Mar 2008 05:28:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JWULb-0000yf-AR for guile-user@gnu.org; Tue, 04 Mar 2008 05:26:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JWULX-0000vI-NI for guile-user@gnu.org; Tue, 04 Mar 2008 05:26:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWULX-0000up-AU for guile-user@gnu.org; Tue, 04 Mar 2008 05:26:07 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JWULW-0003BZ-Ro for guile-user@gnu.org; Tue, 04 Mar 2008 05:26:07 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JWULP-0005NN-Bd for guile-user@gnu.org; Tue, 04 Mar 2008 10:25:59 +0000 Original-Received: from 193.50.110.109 ([193.50.110.109]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 Mar 2008 10:25:59 +0000 Original-Received: from ludo by 193.50.110.109 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 Mar 2008 10:25:59 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.50.110.109 X-Revolutionary-Date: 15 =?iso-8859-1?Q?Vent=F4se?= an 216 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: i686-pc-linux-gnu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:Birk6/levmM3LCVIlp10uLzHBZc= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6441 Archived-At: Hi, Neil Jerram writes: > I agree that any main program should be able to handle its own cleanup > using dynamic-wind. What about a library, though? Yes, you're right, and that's exactly what happens with John's "TAP" modules. At the same time, registering an `atexit' function from within the TAP module seems inelegant: it assumes that the TAP module is used by standalone programs only, and that exactly one Guile process is used for each test that uses the module. If you decide to use a single process to evaluate all the tests, the `atexit' trick no longer works. To me, it would look better if each test case had to insert, say, a `(finish-test)' call at its end, even if it adds more lines. That's roughly what happens with SRFI-64: `test-end' must be invoked and in addition, you may want to finish your standalone scripts with something like `(exit (= (test-runner-fail-count (test-runner-current)) 0))'. > In what sense fragile? As in the example above, for instance. More generally, `atexit' hooks are used only for their side effects, so the order in which they are invoked is crucial. However, it may often be hard to know exactly in what order or when a given hook will be called, because you don't necessarily know what hooks have been registered. Not to mention the interaction with the C `atexit', `on_exit', `exit', `_exit', etc. Now, I'd like to see why/how AutoGen uses it. Thanks, Ludovic.