This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: hook? primitive
cwitty@newtonlabs.com (Carl R. Witty) writes:
> Greg Badros <gjb@cs.washington.edu> writes:
>
> > Yes, most definitely. I need empty-hook? in Scwm for knowing whether I
> > should XSelectInput on MotionNotify events or not. And the arity is
> > essential for supporting a UI that permits interactively adding
> > apropriate procedures to the various supported hooks (we can filter the
> > potential procs based on their arity matching the arity of the hook
> > we're manipulating.)
>
> That doesn't sound very appealing to me. Not all 3-argument functions
> are created equal; just knowing the number of arguments is not enough
> information to tell whether the function is really suitable for the
> hook. It sounds fairly confusing to filter out some but not all
> unsuitable functions simply by checking the arity; it would be better
> to put a property on the function that says what its type is, and do a
> real filter.
Agreed, of course, and part of our planned event-rewrite addresses a bit
of that (especially for bindings, but we could do the same thing with
hooks).
> (Of course, maybe the functions and hooks you're dealing with are such
> that filtering on arity works well enough. But it's still a hack,
> that won't work as more functions and hooks are added.)
That doesn't mean that you should have *less* information about a hooks
intended procedure type. Ideally the hook would be able to report more
information about the intended kind of procedure.
Greg