(goops.info.gz) Method Definition Internals
Info Catalog
(goops.info.gz) Basic Method Definition
(goops.info.gz) Adding Methods to Generic Functions
Method Definition Internals
---------------------------
`define-method'
* checks the form of the first parameter, and applies the following
steps to the accessor's setter if it has the `(setter ...)' form
* interpolates a call to `define-generic' or `define-accessor' if a
generic function is not already defined with the supplied name
* calls `method' with the PARAMETERs and BODY, to make a new method
instance
* calls `add-method!' to add this method to the relevant generic
function.
- syntax: method (parameter ...) . body
Make a method whose specializers are defined by the classes in
PARAMETERs and whose procedure definition is constructed from the
PARAMETER symbols and BODY forms.
The PARAMETER and BODY parameters should be as for `define-method'
( define-method Basic Method Definition.).
`method'
* extracts formals and specializing classes from the PARAMETERs,
defaulting the class for unspecialized parameters to `<top>'
* creates a closure using the formals and the BODY forms
* calls `make' with metaclass `<method>' and the specializers and
closure using the `#:specializers' and `#:procedure' keywords.
- procedure: make-method specializers procedure
Make a method using SPECIALIZERS and PROCEDURE.
SPECIALIZERS should be a list of classes that specifies the
parameter combinations to which this method will be applicable.
PROCEDURE should be the closure that will applied to the generic
function parameters when this method is invoked.
`make-method' is a simple wrapper around `make' with metaclass
`<method>'.
- generic: add-method! target method
Generic function for adding method METHOD to TARGET.
- method: add-method! (generic <generic>) (method <method>)
Add method METHOD to the generic function GENERIC.
- method: add-method! (proc <procedure>) (method <method>)
If PROC is a procedure with generic capability (
generic-capability? Extending Guiles Primitives.), upgrade it to a
primitive generic and add METHOD to its generic function
definition.
- method: add-method! (pg <primitive-generic>) (method <method>)
Add method METHOD to the generic function definition of PG.
Implementation: `(add-method! (primitive-generic-generic pg)
method)'.
- method: add-method! (whatever <top>) (method <method>)
Raise an error indicating that WHATEVER is not a valid generic
function.
Info Catalog
(goops.info.gz) Basic Method Definition
(goops.info.gz) Adding Methods to Generic Functions
automatically generated byinfo2html