[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trigger action at exit?

From: Ludovic Courtès
Subject: Re: Trigger action at exit?
Date: Tue, 04 Mar 2008 11:25:50 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)


Neil Jerram <address@hidden> 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"

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

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]