Next: , Previous: , Up: multimethods   [Index]


19.5 Built-in multimethod definers

Function: type-unique-identifiers-of obj

Object–type inspector function; return the list of UIDs in the type hierarchy of obj. When this function does not recognise an object’s type: the return value just identifies obj as of type <top>. This function can recognise automatically all the instances of types declared by define-record-type. This function recognises only the following built–in types:

<compound-condition> <record> <struct> <hashtable>
<positive-fixnum> <negative-fixnum> <zero-fixnum>
<positive-bignum> <negative-bignum>
<positive-flonum> <negative-flonum>
<positive-zero-flonum> <negative-zero-flonum>
<positive-ratnum> <negative-ratnum>
<zero-cflonum> <non-zero-cflonum>
<zero-compnum> <inexact-compnum> <exact-compnum>
<char> <empty-string> <nestring>
<gensym> <symbol>
<empty-vector> <nevector>
<empty-bytevector> <nebytevector>
<null> <pair>
<binary-input/output-port> <textual-input/output-port>
<binary-input-port>  <textual-input-port>
<binary-output-port> <textual-output-port>
<transcoder>
<procedure>
<top>
Syntax: define-generic ?name ?formals ?clause
Auxiliary Syntax: merge-with-multimethods ?generic

Define a new ordinary multimethod (a macro) and bind it to ?name. The number of arguments is specified by ?formals: a list of identifiers, one for each argument; the list is used only to determine the number of arguments (it can be used to document the intended meaning of the arguments).

When the optional merge-with-multimethods clause is used: the internal methods table is initialised to the union of the methods tables from the ?generic arguments, which must be ordinary multimethod identifiers. The union is performed by visiting arguments from left to right; when two methods have the same signature, the one from the leftmost multimethod takes precedence.

Syntax: define-generic* ?name ?formals ?clause
Auxiliary Syntax: merge-with-multimethods ?generic

Define a new starred multimethod (a macro) and bind it to ?name. The number of arguments is specified by ?formals: a list of identifiers, one for each argument; the list is used only to determine the number of arguments (it can be used to document the intended meaning of arguments).

When the optional merge-with-multimethods clause is used: the internal methods tables are initialised to the unions of the methods tables from the ?generic arguments, which must be starred multimethod identifiers. The union is performed by visiting arguments from left to right; when two methods have the same signature, the one from the leftmost multimethod takes precedence.


Next: , Previous: , Up: multimethods   [Index]