This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: The taming of the before-gc-hook (was Re: Upcoming 1.3.2 release)
Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se> writes:
> Using a special registration function and mechanism for the
> before-gc-hook is certainly one possibility, and, maybe it is the most
> easily maintainable in the long run.
>
> I'd like to propose two additional alternatives:
>
> 1. The C programmer sees two hooks
>
> scm_before_gc_hook
> scm_after_gc_hook
>
> to which he can attach his C functions (wrapped as a subr).
>
> The Scheme programmer sees only after-gc-hook (which is in fact
> the hook stored in scm_after_gc_hook).
>
> This is as safe the special registration function alternative, but the
> user interface is more symmetric and less code is required to
> implement it.
Why is a C function on scm_before_gc_hook any safer than a Scheme
function? The C function can just as easily call guile functions
which require space to be grabbed.
--
Harvey J. Stein
Bloomberg LP
hjstein@bfr.co.il