Subject: Re: bug#10581: exit-hook is undocumented and is not called from a non-interactive environment

From: Andy Wingo <[email-masked]>
Date: Sun, 05 Feb 2012 12:50:39 +0100

Hi Andrew,

On Sun 22 Jan 2012 20:58, Andrew Psaltis <[email-masked]> writes:

> After doing some web searches, I found an answer in "exit-hook",
> except that it was not clear from the Guile reference manual that it
> existed.  It should probably be documented a little more clearly.

It's not documented at all, actually.  It was added in 1998 to
boot-9.scm with the following comment:

  ;;; This hook is run at the very end of an interactive session.
  ;;;
  (define exit-hook (make-hook))

It has not been changed since then.

> When I write a scheme script that adds some function to exit-hook, it
> is not invoked from a non-interactive call to guile.

Indeed, as the comment notes.

I think it's fair to say that this is a historical interface, and that
it probably shouldn't be changed.

Why not use atexit(), if you need to clean up the C library?  Just
wondering.

Andy
-- 
http://wingolog.org/