[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scm_create_hook
From: |
Dirk Herrmann |
Subject: |
Re: scm_create_hook |
Date: |
Sun, 27 May 2001 17:26:01 +0200 (MEST) |
On 27 May 2001, Michael Livshin wrote:
> SCM
> scm_create_hook (const char *name, int n_args)
> {
> SCM hook = make_hook (SCM_MAKINUM (n_args), "scm_create_hook");
> scm_c_define (name, hook);
> scm_protect_object (hook);
> return hook;
> }
>
> question: what the call to `scm_protect_object' is there for? there's
> no corresponding call to `unprotect' anywhere, and I thought
> `scm_c_define' should hold onto the value anyway?
AFAIK, scm_create_hook is only used in gc.c, and the function seems to be
designed exactly for the way it is used there: The need to protect the
freshly created hook comes from the fact, that in gc.c the hook is stored
in a global SCM variable. scm_c_define itself does not make the object
protected, because as soon as the binding is overridden, the object may be
collected.
I think that scm_create_hook should be removed (standard postfix: after a
phase of deprecation :-). The only place where it is used in guile is
gc.c. With the existence of scm_gc_register_root the call of
scm_protect_object will become unnecessary, and the remaining
functionality is better placed directly into the initializing code at
gc.c.
Best regards,
Dirk Herrmann
- scm_create_hook, Michael Livshin, 2001/05/26
- Re: scm_create_hook,
Dirk Herrmann <=