Next: multimethods next, Previous: multimethods defining, Up: multimethods [Index]
Add a new method to an already existent generic function ?generic, either ordinary or starred:
:primary
syntax: ?generic can be either an ordinary or
starred generic function.
:before
, :after
or
:around
syntax: ?generic must be a starred generic
function.
The list of ?arg-spec specifies the type of the arguments for which this method specialises the generic function; an ?arg-spec can be:
(brace ?arg ?type)
Where ?arg is the formal name of the argument, ?type the
type identifier of the expected operand, brace
is the identifier
exported by (vicare)
and reexported by (vicare
language-extensions multimethods)
.
?arg
Where ?arg is the formal name of the argument. In this case the
type defaults to <top>
, which is interpreted as parent of every
other type (and so it has the least specificity).
If the ?generic function name comes with ?type arguments: such arguments specify the type of the return values. The types are used to validate the return values of the method’s closure object, but they do not constitute the types of values returned by the multimethod application.
If a method is defined with the same signature of an already registered method: the old method is overwritten by the new one.
In the lexical context of the ?body forms: the fluid syntax
__who__
is bound to the quoted name of the multimethod,
?generic.
Add a new method to an already existent multimethod ?generic, either ordinary or starred:
:primary
syntax: ?generic can be either an ordinary or
starred multimethod.
:before
, :after
or :around
syntax: ?generic must be a starred multimethod.
?types must be a list of type identifiers for which this method specialises the generic function. ?closure must be an expression which, evaluated at run–time, returns the method’s implementation closure. It is responsibility of the programmer to make sure that ?types and ?closure are coherent.
Next: multimethods next, Previous: multimethods defining, Up: multimethods [Index]