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

19 Multimethods dispatching

In the context of the library (vicare language-extensions multimethods): generic functions, or multimethods, are interfaces to procedures that can be specialised to the (possibly conventional) data types of their arguments; each specialisation of a generic function is called method. When applying a generic function to a tuple of arguments, the most specific method with respect to the arguments’ types is chosen.

The library defines two kinds of generic functions: ordinary and starred. Ordinary generic functions only have one (primary) method for each possible tuple of argument types. Starred generic functions may have qualified primary, before, after and around methods for each possible tuple of argument types; the methods are applied (composed) according to a defined protocol.

Multimethods are meant to be used with the typed language.