gauche.hook
- Hooks ¶Provides a hook object, which manages a list of closures to be called at certain time.
This API of hooks are upper-compatible of Guile’s, with the following extensions.
run-hook
.
delete-hook!
,
for consistency with SRFI-1 and others. remove-hook!
is
defined as an alias of delete-hook!
for compatibility with Guile.
If you’re writing portable code, SRFI-173 provides the basic
hook functionality (see srfi.173
- Hooks (srfi)).
{gauche.hook
}
A hook class, which keeps a list of procedures to be called at once.
The object-apply
method is defined on <hook>
class,
so you can "apply" a hook object as if it were a procedure—which
causes all the registered procedure to be invoked.
{gauche.hook
}
Creates a new hook object with given arity, which should be a
non-negative integer.
{gauche.hook
}
Returns true if obj is a hook object.
{gauche.hook
}
Returns true if hook’s procedure list is empty.
{gauche.hook
}
Adds a procedure proc to hook. If append?
is given and true, proc is added at the end of the list.
Otherwise, proc is added at the front of the list.
The proc has to be called with the arity given
at the make-hook
.
{gauche.hook
}
Removes proc from the procedure list of hook.
Remove-hook!
is an alias of delete-hook!
just for
compatibility with Guile.
{gauche.hook
}
Empties hook’s procedure list.
{gauche.hook
}
Returns a copy of hook’s procedure list.
{gauche.hook
}
Calls hook’s procedures in order, with arguments arg ….
The number of arguments must match the arity given at make-hook
.