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: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Subject: Re: Unwanted hook names (was Re: interface reductions)
- From: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Date: 26 May 2000 15:36:12 -0400
- Cc: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>, "Greg J. Badros" <gjb at cs dot washington dot edu>, Guile Mailing List <guile at sourceware dot cygnus dot com>
- References: <xy7em6pqu1w.fsf@mdj.nada.kth.se><Pine.LNX.4.21.0005261619360.7713-100000@marvin.ida.ing.tu-bs.de>
Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
> > 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 :-)
How about the following set of functions and a macro?
SCM scm_c_make_hook (int n_args);
void scm_c_set_object_name (SCM obj, const char *name);
void scm_c_environment_define (SCM env, const char *name, SCM obj);
#define SCM_DEFINE_HOOK(CNAME, ENV, SNAME, NARGS, DOCS) \
SCM_SNARF_DECL( \
SCM CNAME \
) \
SCM_SNARF_INIT( \
CNAME = scm_c_make_hook (NARGS); \
scm_c_set_object_name (CNAME, SNAME); \
scm_c_environment_define (ENV, SNAME, CNAME); \
) \
SCM_SNARF_DOCS(...)
scm_c_environment_define will call scm_protect_object if necessary.
In my feeling, I don't think scm_create_hook is really necessary.
One can make it by myself if one wants it.
-- Kei