The method-hooks Reference Manual

This is the method-hooks Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 08 18:57:43 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 method-hooks

simple qualifiable hooks defined like methods with the option to modify the dispatch method and how dispatch happens

Maintainer

Gnuxie <>

Author

Gnuxie <>

Home Page

https://gnuxie.gitlab.io/method-hooks/

Bug Tracker

https://gitlab.com/Gnuxie/method-hooks/issues

License

Mozilla Public License Version 2.0

Version

0.1.0

Source

method-hooks.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 method-hooks/src

Source

method-hooks.asd.

Parent Component

method-hooks (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 method-hooks/method-hooks.asd

Source

method-hooks.asd.

Parent Component

method-hooks (system).

ASDF Systems

method-hooks.


4.1.2 method-hooks/src/package.lisp

Source

method-hooks.asd.

Parent Component

src (module).

Packages

method-hooks.


4.1.3 method-hooks/src/macro-utils.lisp

Source

method-hooks.asd.

Parent Component

src (module).

Internals

4.1.4 method-hooks/src/combination-management.lisp

Source

method-hooks.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.5 method-hooks/src/known-dispatchers.lisp

Source

method-hooks.asd.

Parent Component

src (module).


4.1.6 method-hooks/src/hook-management.lisp

Source

method-hooks.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.7 method-hooks/src/method-hooks.lisp

Source

method-hooks.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 method-hooks

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Macros

Macro: defhook (generic-function hook-name &rest args)

define a hook to be to be called by the effective method.

This macro has roughly the same signature as defmethod ‘(DEFHOOK GENERIC-FUNCTION HOOK-NAME {QUALIFIER} SPECIALIZED-LAMBDA-LIST &BODY BODY)‘ creates a function ‘hook-name‘ with the ‘body‘ then creates a method to dispatch all hooks matching
the type-list for the given generic-function.

See define-hook-generic
See finalize-dispatch-method

Package

method-hooks.

Source

method-hooks.lisp.

Macro: define-dispatch (name lambda-list &body body)

the lambda list should accept two arguments:
the list of arguments given by the current method call.
the specific hooks (as named or unamed functions) for the qualified method (that we will be dispatching from).

you should then use the arguments to dispatch the specific hooks as you wish in the body.
if the body returns a result, by default the method will also return that result, this can be overriden with finalize-dispatch-method.

See finalize-dispatch-method
See dispatch

Package

method-hooks.

Source

combination-management.lisp.

Macro: define-hook-generic (name gf-lambda-list &rest options)

utility to help with gf’s with method combination by remembering the combination type

by default the combination type becomes the default qualifier for any newly defined hooks this can be overriden by not using this and using defgeneric or supplying
the option :default-qualifier.

supplying ‘:hook-point t‘ will create a method qualified with the default-qualifier so that the generic acts like an extensible hook point and will not signal no-applicable-method error when no hooks have been defined.

See defhook

Package

method-hooks.

Source

method-hooks.lisp.

Macro: dispatch (generic-function qualifier specialized-lambda-list)

dispatch the hooks using the default dispatcher for the given qualified specific method.

See define-dispatch
See dispatch-function
See set-dispatch-for-qualifier

Package

method-hooks.

Source

combination-management.lisp.

Macro: finalize-dispatch-method (generic-function &rest args)

add a body to the method which dispatched the hooks for the given specialized-lambda-list
useful if you wanted to use call-next-method

For the definition to be effective, it must be defined after every specific hook for the same method hence finalize.

See defhook

Package

method-hooks.

Source

method-hooks.lisp.

Macro: make-dispatcher (function-constructor)
Package

method-hooks.

Source

combination-management.lisp.


6.1.2 Ordinary functions

Function: clear-hook-table ()

will not require recompilation of all the forms unless an existing hook definition is redefined or a method is redefined

Package

method-hooks.

Source

hook-management.lisp.

Function: dispatch-for-qualifier (qualifier)

the dispatcher used for the given qualifier

See define-dispatch
See dispatcher

Package

method-hooks.

Source

combination-management.lisp.

Function: set-dispatch-for-qualifier (qualifier dispatch)

accepts two symbols, sets the dispatcher to be used for the given qualifier

See define-dispatch
See dispatcher

Package

method-hooks.

Source

combination-management.lisp.

Function: specific-hooks-for-generic (type-list generic-function qualifier)

get the hooks specific to the type specializer list and qualifier

Package

method-hooks.

Source

hook-management.lisp.


6.1.3 Generic functions

Generic Reader: dispatch-function (object)
Generic Writer: (setf dispatch-function) (object)
Package

method-hooks.

Methods
Reader Method: dispatch-function ((dispatcher dispatcher))
Writer Method: (setf dispatch-function) ((dispatcher dispatcher))

a function object for the current environment

Source

combination-management.lisp.

Target Slot

dispatch-function.

Generic Reader: dispatch-function-constructor (object)
Generic Writer: (setf dispatch-function-constructor) (object)
Package

method-hooks.

Methods
Reader Method: dispatch-function-constructor ((dispatcher dispatcher))
Writer Method: (setf dispatch-function-constructor) ((dispatcher dispatcher))

a lambda expression used to construct the function object for dispatch-function.

Source

combination-management.lisp.

Target Slot

dispatch-function-constructor.

Generic Reader: hook-name (object)
Package

method-hooks.

Methods
Reader Method: hook-name ((hook hook))

automatically generated reader method

Source

hook-management.lisp.

Target Slot

hook-name.

Generic Writer: (setf hook-name) (object)
Package

method-hooks.

Methods
Writer Method: (setf hook-name) ((hook hook))

automatically generated writer method

Source

hook-management.lisp.

Target Slot

hook-name.

Generic Reader: qualifier (object)
Package

method-hooks.

Methods
Reader Method: qualifier ((hook hook))

automatically generated reader method

Source

hook-management.lisp.

Target Slot

qualifier.

Generic Writer: (setf qualifier) (object)
Package

method-hooks.

Methods
Writer Method: (setf qualifier) ((hook hook))

automatically generated writer method

Source

hook-management.lisp.

Target Slot

qualifier.


6.1.4 Standalone methods

Method: make-load-form ((self dispatcher) &optional environment)
Source

combination-management.lisp.


6.1.5 Classes

Class: dispatcher
Package

method-hooks.

Source

combination-management.lisp.

Direct methods
Direct slots
Slot: dispatch-function-constructor

a lambda expression used to construct the function object for dispatch-function.

Type

list

Initargs

:dispatch-function-constructor

Readers

dispatch-function-constructor.

Writers

(setf dispatch-function-constructor).

Slot: dispatch-function

a function object for the current environment

Type

function

Initargs

:dispatch-function

Readers

dispatch-function.

Writers

(setf dispatch-function).

Class: hook
Package

method-hooks.

Source

hook-management.lisp.

Direct methods
Direct slots
Slot: qualifier
Type

symbol

Initargs

:qualifier

Readers

qualifier.

Writers

(setf qualifier).

Slot: hook-name
Type

symbol

Initargs

:hook-name

Readers

hook-name.

Writers

(setf hook-name).


6.2 Internals


6.2.1 Special variables

Special Variable: *dispatch-for-qualifier*

used to lookup the symbol for a dispatcher

Package

method-hooks.

Source

combination-management.lisp.

Special Variable: *dispatch-table*

used to lookup the dispatcher for a symbol

Package

method-hooks.

Source

combination-management.lisp.

Special Variable: *hook-generics*

hash table holding information on all of the generics used either indirectly with defhook or directly with define-hook-generic

Package

method-hooks.

Source

hook-management.lisp.

Special Variable: *hooks*

information about all the hooks used in the image

Package

method-hooks.

Source

hook-management.lisp.


6.2.2 Macros

Macro: %defhook-fun (hook-name vanilla-lambda-list &body body)

this is literally just a copy of defun atm.

Package

method-hooks.

Source

method-hooks.lisp.

Macro: %define-method-dispatch (generic-function qualifier specialized-lambda-list &body body)

defines the dispatch method for hooks, will remember the qualifier for the gf

Package

method-hooks.

Source

method-hooks.lisp.

Macro: %destructure-defhook-args (args &body body)
Package

method-hooks.

Source

macro-utils.lisp.

Macro: %lay-method-base-for-dispatch (generic-function qualifier type-list descriptive-lambda-list &body body)
Package

method-hooks.

Source

method-hooks.lisp.

Macro: %load-specializers-to-table (generic-function type-list qualifier)

creates a form to load the hooks specific to the gf/type-list/qualifier
from the compilation environment into the internal table inside the runtime environment.

Package

method-hooks.

Source

method-hooks.lisp.

Macro: destructure-specialized-lambda-list (descriptive-lambda-list-sym vanilla-lambda-list-sym type-list-sym specialized-lambda-list &body body)

if specialized-lambda-list is ((a integer) b): descriptive-lambda-list will be ((x integer) (x t)) type-list will be (integer t) and vanilla-lambda-list is (a b)

Package

method-hooks.

Source

macro-utils.lisp.

Macro: with-effective-qualifier (gf-name qualifier &body body)

take generic function and a symbol bound to a qualifier and mask that symbol with the effective qualifier.

The effective qualifier is the default qualifier for the given generic function should there be one defined by a define-hook-generic form.

Package

method-hooks.

Source

method-hooks.lisp.


6.2.3 Ordinary functions

Function: effective-qualifier (gf-name qualifier)
Package

method-hooks.

Source

hook-management.lisp.

Function: get-default-qualifier (gf-name)
Package

method-hooks.

Source

hook-management.lisp.

Function: intern-hook (gf-name hook-name type-list qualifier)

intern the hook into the hooks hashtable by symbol name and into the generic functions table
by type-list and qualifier

as we are keeping references to hook objects in two places and due to the dificulty of keeping both
exactly up to date, specific-hooks-for-generic will remove old references from the hook functions method list before returning the result.

Package

method-hooks.

Source

hook-management.lisp.

Function: intern-hook-generic (gf-name method-combination default-qualifier)

will copy methods across if an existing gf is defined with them

Package

method-hooks.

Source

hook-management.lisp.

Function: intern-undeclared-hook-generic (gf-name)

if we stumble across a generic which we don’t know about (ie from using defhook without define-hook-generic) then we must intern it in an appropriate way.

Package

method-hooks.

Source

hook-management.lisp.


6.2.4 Generic functions

Generic Reader: combination (object)
Package

method-hooks.

Methods
Reader Method: combination ((hook-generic hook-generic))

automatically generated reader method

Source

hook-management.lisp.

Target Slot

combination.

Generic Writer: (setf combination) (object)
Package

method-hooks.

Methods
Writer Method: (setf combination) ((hook-generic hook-generic))

automatically generated writer method

Source

hook-management.lisp.

Target Slot

combination.

Generic Reader: default-qualifier (object)
Package

method-hooks.

Methods
Reader Method: default-qualifier ((hook-generic hook-generic))

automatically generated reader method

Source

hook-management.lisp.

Target Slot

default-qualifier.

Generic Writer: (setf default-qualifier) (object)
Package

method-hooks.

Methods
Writer Method: (setf default-qualifier) ((hook-generic hook-generic))

automatically generated writer method

Source

hook-management.lisp.

Target Slot

default-qualifier.

Generic Reader: methods (object)
Package

method-hooks.

Methods
Reader Method: methods ((hook-generic hook-generic))

automatically generated reader method

Source

hook-management.lisp.

Target Slot

methods.

Generic Writer: (setf methods) (object)
Package

method-hooks.

Methods
Writer Method: (setf methods) ((hook-generic hook-generic))

automatically generated writer method

Source

hook-management.lisp.

Target Slot

methods.


6.2.5 Classes

Class: hook-generic
Package

method-hooks.

Source

hook-management.lisp.

Direct methods
Direct slots
Slot: methods
Type

hash-table

Initform

(make-hash-table :test (function equal))

Initargs

:methods

Readers

methods.

Writers

(setf methods).

Slot: combination
Type

symbol

Initargs

:combination

Readers

combination.

Writers

(setf combination).

Slot: default-qualifier
Type

symbol

Initargs

:default-qualifier

Readers

default-qualifier.

Writers

(setf default-qualifier).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
C   D   E   F   G   H   I   M   Q   S   W  
Index Entry  Section

%
%defhook-fun: Private macros
%define-method-dispatch: Private macros
%destructure-defhook-args: Private macros
%lay-method-base-for-dispatch: Private macros
%load-specializers-to-table: Private macros

(
(setf combination): Private generic functions
(setf combination): Private generic functions
(setf default-qualifier): Private generic functions
(setf default-qualifier): Private generic functions
(setf dispatch-function): Public generic functions
(setf dispatch-function): Public generic functions
(setf dispatch-function-constructor): Public generic functions
(setf dispatch-function-constructor): Public generic functions
(setf hook-name): Public generic functions
(setf hook-name): Public generic functions
(setf methods): Private generic functions
(setf methods): Private generic functions
(setf qualifier): Public generic functions
(setf qualifier): Public generic functions

C
clear-hook-table: Public ordinary functions
combination: Private generic functions
combination: Private generic functions

D
default-qualifier: Private generic functions
default-qualifier: Private generic functions
defhook: Public macros
define-dispatch: Public macros
define-hook-generic: Public macros
destructure-specialized-lambda-list: Private macros
dispatch: Public macros
dispatch-for-qualifier: Public ordinary functions
dispatch-function: Public generic functions
dispatch-function: Public generic functions
dispatch-function-constructor: Public generic functions
dispatch-function-constructor: Public generic functions

E
effective-qualifier: Private ordinary functions

F
finalize-dispatch-method: Public macros
Function, clear-hook-table: Public ordinary functions
Function, dispatch-for-qualifier: Public ordinary functions
Function, effective-qualifier: Private ordinary functions
Function, get-default-qualifier: Private ordinary functions
Function, intern-hook: Private ordinary functions
Function, intern-hook-generic: Private ordinary functions
Function, intern-undeclared-hook-generic: Private ordinary functions
Function, set-dispatch-for-qualifier: Public ordinary functions
Function, specific-hooks-for-generic: Public ordinary functions

G
Generic Function, (setf combination): Private generic functions
Generic Function, (setf default-qualifier): Private generic functions
Generic Function, (setf dispatch-function): Public generic functions
Generic Function, (setf dispatch-function-constructor): Public generic functions
Generic Function, (setf hook-name): Public generic functions
Generic Function, (setf methods): Private generic functions
Generic Function, (setf qualifier): Public generic functions
Generic Function, combination: Private generic functions
Generic Function, default-qualifier: Private generic functions
Generic Function, dispatch-function: Public generic functions
Generic Function, dispatch-function-constructor: Public generic functions
Generic Function, hook-name: Public generic functions
Generic Function, methods: Private generic functions
Generic Function, qualifier: Public generic functions
get-default-qualifier: Private ordinary functions

H
hook-name: Public generic functions
hook-name: Public generic functions

I
intern-hook: Private ordinary functions
intern-hook-generic: Private ordinary functions
intern-undeclared-hook-generic: Private ordinary functions

M
Macro, %defhook-fun: Private macros
Macro, %define-method-dispatch: Private macros
Macro, %destructure-defhook-args: Private macros
Macro, %lay-method-base-for-dispatch: Private macros
Macro, %load-specializers-to-table: Private macros
Macro, defhook: Public macros
Macro, define-dispatch: Public macros
Macro, define-hook-generic: Public macros
Macro, destructure-specialized-lambda-list: Private macros
Macro, dispatch: Public macros
Macro, finalize-dispatch-method: Public macros
Macro, make-dispatcher: Public macros
Macro, with-effective-qualifier: Private macros
make-dispatcher: Public macros
make-load-form: Public standalone methods
Method, (setf combination): Private generic functions
Method, (setf default-qualifier): Private generic functions
Method, (setf dispatch-function): Public generic functions
Method, (setf dispatch-function-constructor): Public generic functions
Method, (setf hook-name): Public generic functions
Method, (setf methods): Private generic functions
Method, (setf qualifier): Public generic functions
Method, combination: Private generic functions
Method, default-qualifier: Private generic functions
Method, dispatch-function: Public generic functions
Method, dispatch-function-constructor: Public generic functions
Method, hook-name: Public generic functions
Method, make-load-form: Public standalone methods
Method, methods: Private generic functions
Method, qualifier: Public generic functions
methods: Private generic functions
methods: Private generic functions

Q
qualifier: Public generic functions
qualifier: Public generic functions

S
set-dispatch-for-qualifier: Public ordinary functions
specific-hooks-for-generic: Public ordinary functions

W
with-effective-qualifier: Private macros


A.4 Data types

Jump to:   C   D   F   H   K   M   P   S  
Index Entry  Section

C
Class, dispatcher: Public classes
Class, hook: Public classes
Class, hook-generic: Private classes
combination-management.lisp: The method-hooks/src/combination-management․lisp file

D
dispatcher: Public classes

F
File, combination-management.lisp: The method-hooks/src/combination-management․lisp file
File, hook-management.lisp: The method-hooks/src/hook-management․lisp file
File, known-dispatchers.lisp: The method-hooks/src/known-dispatchers․lisp file
File, macro-utils.lisp: The method-hooks/src/macro-utils․lisp file
File, method-hooks.asd: The method-hooks/method-hooks․asd file
File, method-hooks.lisp: The method-hooks/src/method-hooks․lisp file
File, package.lisp: The method-hooks/src/package․lisp file

H
hook: Public classes
hook-generic: Private classes
hook-management.lisp: The method-hooks/src/hook-management․lisp file

K
known-dispatchers.lisp: The method-hooks/src/known-dispatchers․lisp file

M
macro-utils.lisp: The method-hooks/src/macro-utils․lisp file
method-hooks: The method-hooks system
method-hooks: The method-hooks package
method-hooks.asd: The method-hooks/method-hooks․asd file
method-hooks.lisp: The method-hooks/src/method-hooks․lisp file
Module, src: The method-hooks/src module

P
Package, method-hooks: The method-hooks package
package.lisp: The method-hooks/src/package․lisp file

S
src: The method-hooks/src module
System, method-hooks: The method-hooks system