Generic-procedure methods are dynamically chosen by generators, which are procedures of two arguments. Each generic procedure has a set of associated generators. Whenever the procedure is applied, each associated generator is applied to two arguments: the generic procedure and a list of the dispatch tags for the operands. The return value from the generator is either a method (a procedure accepting that number of arguments) or `#f'. In order for the application to succeed, exactly one of the generic procedure's generators must return a method.
Once a method has been chosen, it is cached. A subsequent call to the generic procedure with operands of the same types will reuse that cached method. Consequently, it is important that generators be functional: they must always compute the same value from the same arguments.
Adds generator to generic's set of generators and returns an unspecified value.
Removes generator from generic's set of generators and returns an unspecified value.
Calls each of generic's set of generators on tags and removes each generator that returns a method. Returns an unspecified value.
As a convenience, each generic procedure can have a default generator, which is called only when all of the other generators have returned `#f'. When created, a generic procedure has no default generator.