Next: Method Generators, Previous: Generic Dispatch, Up: Generic Dispatch
The core of the dispatch mechanism is the generic procedure. This is a procedure that is called in the usual way, but which dispatches to a particular method based on the types of its arguments.
Returns a new generic procedure accepting arity. Arity must specify a minimum of one argument.
Name is used for debugging: it is a symbol that has no role in the semantics of the generic procedure. Name may be
#f
to indicate that the generic procedure is anonymous. If name is not specified, it defaults to `#f'.Examples:
(define foo-bar (make-generic-procedure 2 'bar)) (define foo-baz (make-generic-procedure '(1 . 2) 'foo-baz)) (define foo-mum (make-generic-procedure '(1 . #f)))
Returns `#t' if object is a generic procedure, and `#f' otherwise.
Signals an error if object is not a generic procedure. Caller is a symbol that is printed as part of the error message and is intended to be the name of the procedure where the error occurs.
Returns the arity of generic, as given to
make-generic-procedure
.
Returns the name of generic, as given to
make-generic-procedure
.
Returns `#t' if generic is applicable to operands (which must be a list of objects), and `#f' otherwise.
This condition type is signalled when a generic procedure is applied and there are no applicable methods for the given operands. The condition's operator field contains the generic procedure and the operands field contains the given operands.
This condition type is signalled when a generic procedure is applied and there are more than one applicable methods for the given operands. The condition's operator field contains the generic procedure and the operands field contains the given operands.