This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Unwanted hook names (was Re: interface reductions)
- To: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>, "Greg J. Badros" <gjb at cs dot washington dot edu>
- Subject: Re: Unwanted hook names (was Re: interface reductions)
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Fri, 26 May 2000 17:20:57 +0200 (MEST)
- cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
On 26 May 2000, Mikael Djurfeldt wrote:
> In your patch it doesn't look like you'll deprecate this function
> (maybe as a consequence of my letter).
Yes, it was because of your comments (sorry that I did not make this
clear).
> I think that there generally should be functions behind most snarf
> macros. For example, there are instances where you need to use
> scm_make_subr_opt instead of using snarf macros.
Right, but in my personal opinion it would make sense to separate the
concepts of creating an object and creating a global (or
module-global) binding for an object. This is because I prefer to have a
function that makes a subr, and nothing else, and then to create a binding
for it, in contrast to a beast like scm_make_subr_opt that does it all,
but controlled by flags. But this leads us to a completely different
topic :-)
> I think it should be regarded as appropriate. But, in line with your
> reasoning above, we could already now remove the GC protection.
Newest version of scm_create_hook: When compiling with
SCM_DEBUG_DEPRECATED=1 it basically only creates a hook with a global
binding, but otherwise it also provides the name property automatically
and gc protects the hook. This is in order to provide a smoother
migration, since for a standard compilation everything behaves as it did
before.
SCM
scm_create_hook (const char* name, int n_args)
{
SCM vcell = scm_sysintern0 (name);
SCM hook = make_hook (SCM_MAKINUM (n_args), "scm_create_hook");
SCM_SETCDR (vcell, hook);
#if (SCM_DEBUG_DEPRECATED == 0)
scm_set_object_property_x (hook, scm_makfrom0str ("name"), scm_makfrom0str (name));
scm_protect_object (vcell);
#endif /* SCM_DEBUG_DEPRECATED == 0 */
return hook;
}
Also, I fixed the only place in guile where scm_create_hook was called:
scm_init_gc ()
{
scm_after_gc_hook = scm_create_hook ("after-gc-hook", 0);
+ scm_protect_object (scm_after_gc_hook);
#include "libguile/gc.x"
}
This would in future be done automatically by SCM_DEFINE_HOOK. Also,
init.c needs to be fixed until the deprecated code is actually removed:
RCS file: /cvs/guile/guile/guile-core/libguile/init.c,v
retrieving revision 1.93
diff -u -r1.93 init.c
--- init.c 2000/05/21 20:49:20 1.93
+++ init.c 2000/05/26 15:11:11
@@ -511,7 +511,8 @@
scm_init_gdbint ();
scm_init_hash ();
scm_init_hashtab ();
- scm_init_hooks ();
+ scm_init_objprop ();
+ scm_init_hooks (); /* Requires objprop until hook names are removed */
scm_init_gc (); /* Requires hooks */
#ifdef GUILE_ISELECT
scm_init_iselect ();
@@ -523,7 +524,6 @@
scm_init_mallocs ();
scm_init_modules ();
scm_init_numbers ();
- scm_init_objprop ();
scm_init_options ();
scm_init_pairs ();
scm_init_ports ();
Thanks for all the comments. I hope that we can agree about this.
Dirk