Multimethod
A multimethod is a dispatch mechanism that selects an implementation by applying a dispatch function to multiple arguments, often using their runtime types or values.
Data-Oriented Programming: Reduce software complexity
A multimethod method is a function that provides an implementation for a particular dispatch value.
- How it is used
- Provides extensible polymorphism for generic maps, including single-, multiple-, and dynamic-dispatch designs.
- How deep it goes
- Explains dispatch responsibilities, validation, method wiring, defaults, and three dispatch forms through JavaScript examples.
- Examples
- Demonstrates animal greetings, multilingual animal greetings, name-length behavior, and author-name formatting.
- What you can do after
- Build it from scratch by defining a dispatch function, initializing a multimethod, wiring implementations, and calling it as a regular function.
Read how Data-Oriented Programming: Reduce software complexity explains multimethod →
Clojure: The Essential Reference
A multimethod is a Clojure polymorphic function whose implementation is selected by applying a dispatch function to its arguments.
- How it is used
- Selects polymorphic behavior for values or data using arbitrary dispatch rules rather than type-only method selection.
- How deep it goes
- Explains declaration, method extension, custom hierarchies, removal, inspection, precedence, defaults, and dispatch failures.
- Examples
- Uses a data-driven calculator, runtime operator extension, temperature-based sound speed, collection dispatch, and recursive methods.
- What you can do after
- Build it from scratch, extend implementations, inspect dispatch state, resolve ambiguities, and diagnose unmatched or conflicting methods.
Read how Clojure: The Essential Reference explains multimethod →
Also covered in
What to know first
- polymorphismPolymorphism is a programming-language capability that lets a common operation or interface work with values of different types, with behavior or implementation determined by the type or value.
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
Related concepts
- arrows/multimethodsimplemented by · arrows/multimethods is a JavaScript library that provides an implementation of multimethods.
- polymorphic dispatchhas part · Polymorphic dispatch is runtime selection of an operation implementation based on a call's arguments, function value, or context.
- function overloadingimplements · Function overloading is a programming-language feature in which one name denotes multiple callable signatures or implementations distinguished by parameter types or forms, with applicability determined by the call or context.
- functionkind of · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- methodhas part · A method is a callable function or operation associated with a type, class, or object and invoked through that association.
Questions about multimethod
What is multimethod?
A multimethod is a dispatch mechanism that selects an implementation by applying a dispatch function to multiple arguments, often using their runtime types or values.
Which Manning books explain multimethod?
Data-Oriented Programming: Reduce software complexity and Clojure: The Essential Reference.
What should I know before learning multimethod?
Manning books that teach multimethod usually introduce polymorphism and Python first.
What is multimethod a kind of?
Multimethod is a kind of function. A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
What are the parts of multimethod?
Multimethod includes polymorphic dispatch and method.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

