This is the nhooks Reference Manual, version 1.0.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Sun May 15 05:40:06 2022 GMT+0.
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
The main system appears first, followed by any subsystem dependency.
• The nhooks system |
Qiantan Hong <qhong@alum.mit.edu>
MIT
Improved hooks facility inspired by Serapeum.
1.0.0
serapeum
nhooks.asd (file)
nhooks.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The nhooks.asd file | ||
• The nhooks/nhooks.lisp file |
Next: The nhooks/nhooks․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
nhooks.asd
nhooks (system)
Previous: The nhooks․asd file, Up: Lisp files [Contents][Index]
nhooks (system)
nhooks.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The nhooks package |
nhooks.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported classes |
Next: Exported functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Define hook class.
Type must be something like:
(function (string) (values integer t))
The ‘handler-type’ of the defined hook class has ‘:class’ allocation type, so that all hooks of such class have the same ‘handler-type’.
nhooks.lisp (file)
This is intended to wrap all handler executions.
nhooks.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Return a globally-accessible hook.
The hook can be accessed with ‘find-hook’ at (list NAME OBJECT).
OBJECT is an arbitrary value the hook is associated to.
nhooks.lisp (file)
Return handler matching HANDLER-OR-NAME in HANDLERS sequence.
nhooks.lisp (file)
Return the global hook with name NAME associated to OBJECT, if provided.
The following examples return different hooks:
- (find-hook ’foo-hook)
- (find-hook ’foo-hook ’bar-class)
- (find-hook ’foo-hook (make-instance ’bar-class))
nhooks.lisp (file)
Next: Exported classes, Previous: Exported functions, Up: Exported definitions [Contents][Index]
This can be used to reverse the execution order, return a single value, etc.
nhooks.lisp (file)
Return the result of the composition of the HOOK handlers on ARGS, from
oldest to youngest.
Without handler, return ARGS as values.
This is an acceptable ‘combination’ for ‘hook’.
nhooks.lisp (file)
Return the list of values until the first nil result.
Handlers after the failing one are not run.
This is an acceptable ‘combination’ for ‘hook’.
nhooks.lisp (file)
Return the value of the first non-nil result.
Handlers after the successful one are not run.
You need to check if the hook has handlers to know if a NIL return value is due
to all handlers failing or an empty hook.
This is an acceptable ‘combination’ for ‘hook’.
nhooks.lisp (file)
Return the list of the results of the HOOK handlers applied from youngest to
oldest to ARGS.
Return ’() when there is no handler.
This is an acceptable ‘combination’ for ‘hook’.
nhooks.lisp (file)
nhooks.lisp (file)
Description of the handler. This is purely informative.
nhooks.lisp (file)
Disable HANDLERS.
Without HANDLERS, disable all of them.
nhooks.lisp (file)
nhooks.lisp (file)
Enable HANDLERS.
Without HANDLERS, enable all of them.
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
The handler function. It can be an anonymous function.
nhooks.lisp (file)
The exptected function type of handlers.
nhooks.lisp (file)
nhooks.lisp (file)
A list with elements of the form (HANDLER . ENABLE-P).
‘run-hook’ only runs HANDLERs associated with non nil ENABLE-P. This is useful it the user wishes to disable some or all handlers without removing them from the hook.
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
Name of the handler.
It defaults to the function name if ‘fn’ is a named function.
This is useful so that the user can build handlers out of anonymous functions.
nhooks.lisp (file)
If the handler is meant to be a setter, PLACE describes what is set.
PLACE can be a symbol or a pair (CLASS SLOT).
This can be left empty if the handler is not a setter.
nhooks.lisp (file)
This is equivalent to setting the combination function to ‘combine-hook-until-failure’ and calling ‘run-hook’.
nhooks.lisp (file)
This is equivalent to setting the combination function to ‘combine-hook-until-success’ and calling ‘run-hook’.
nhooks.lisp (file)
If the handler is meant to be a setter, VALUE can be used to describe what FN is
going to set to PLACE.
In particular, PLACE and VALUE can be used to compare handlers.
This can be left empty if the handler is not a setter.
nhooks.lisp (file)
Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
Handlers are wrappers around functions used in typed hooks.
They serve two purposes as opposed to regular functions:
- They can embed a NAME so that anonymous functions can be conveniently used in hooks.
- If the handler is meant to be a setter, the PLACE and VALUE slot can be used to identify and compare setters.
With this extra information, it’s possible to compare handlers and, in particular, avoid duplicates in hooks.
nhooks.lisp (file)
standard-object (class)
Name of the handler.
It defaults to the function name if ‘fn’ is a named function.
This is useful so that the user can build handlers out of anonymous functions.
symbol
:name
name (generic function)
(setf name) (generic function)
Description of the handler. This is purely informative.
string
:description
""
description (generic function)
(setf description) (generic function)
The handler function. It can be an anonymous function.
If the handler is meant to be a setter, PLACE describes what is set.
PLACE can be a symbol or a pair (CLASS SLOT).
This can be left empty if the handler is not a setter.
(or symbol list)
:place
place (generic function)
(setf place) (generic function)
If the handler is meant to be a setter, VALUE can be used to describe what FN is
going to set to PLACE.
In particular, PLACE and VALUE can be used to compare handlers.
This can be left empty if the handler is not a setter.
:value
value (generic function)
(setf value) (generic function)
This hook class serves as support for typed-hook.
Typing in hook is crucial to guarantee that a hook is well formed, i.e. that it’s handlers accept the right argument types and return the right value types.
nhooks.lisp (file)
standard-object (class)
The exptected function type of handlers.
:handler-type
handler-type (generic function)
A list with elements of the form (HANDLER . ENABLE-P).
‘run-hook’ only runs HANDLERs associated with non nil ENABLE-P. This is useful it the user wishes to disable some or all handlers without removing them from the hook.
list
:handlers-alist
(quote nil)
handlers-alist (generic function)
(setf handlers-alist) (generic function)
This can be used to reverse the execution order, return a single value, etc.
(or symbol function)
:combination
(function nhooks:default-combine-hook)
combination (generic function)
(setf combination) (generic function)
nhooks.lisp (file)
hook (class)
:class
(quote (function (&rest t)))
nhooks.lisp (file)
hook (class)
:class
(quote (function (number) number))
nhooks.lisp (file)
hook (class)
:class
(quote (function (string) string))
nhooks.lisp (file)
hook (class)
:class
(quote (function nil))
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal functions | ||
• Internal generic functions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Global hook table.
nhooks.lisp (file)
Next: Internal generic functions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
Add HANDLER to HOOK if not already in it.
Return HOOK.
HANDLER is also not added if it’s disabled.
If APPEND is non-nil, HANDLER is added at the end.
nhooks.lisp (file)
Invoke compiler to probe the type of FUNCTION.
If type of FUNCTION contradicts with FTYPE, raise an error.
If FTYPE is nil, nothing is done.
nhooks.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
nhooks.lisp (file)
Return non-nil if FN1 and FN2 are equal.
Handlers are equal if they are setters of the same place and same value, or if
their names are equal.
nhooks.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L N |
---|
Jump to: | F L N |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A C D E F G H M N P R V W |
---|
Jump to: | (
A C D E F G H M N P R V W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | %
C D F H N P S V |
---|
Jump to: | %
C D F H N P S V |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C H N P S |
---|
Jump to: | C H N P S |
---|