Hi, Neil Jerram <[EMAIL PROTECTED]> 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.
