liveBook · Manning

Multiple dispatch

Multiple dispatch is a method-selection mechanism that chooses an implementation based on the types of multiple arguments.

How 2 Manning books explain it

Julia as a Second Language

Multiple dispatch is a method-selection mechanism that chooses an operation implementation based on the types of all dispatched arguments.

How it is used
Selects behavior for game-combat operations according to both participants’ types.
How deep it goes
Works through method signatures, inspection, missing-method errors, and runtime selection without detailing dispatch implementation internals.
Examples
Uses REPL battles between archers and knights, a missing knight-versus-knight method, and a battle outcome function.
What you can do after
Build it from scratch by adding matchup-specific Julia methods and inspecting which signatures are available.

Read how Julia as a Second Language explains multiple dispatch →

Data-Oriented Programming: Reduce software complexity

Multiple dispatch is a dispatch mechanism that selects an implementation based on the types of several arguments.

How it is used
Uses multimethods to select behavior from multiple arguments represented as generic maps.
How deep it goes
Explains dispatch signatures, validation, emitted values, method wiring, calls, and ordering, while deferring dynamic dispatch.
Examples
Demonstrates animal greetings selected by dog, cat, or cow types combined with French or English language maps.
What you can do after
Build it from scratch by defining a dispatch function, registering methods, and calling the multimethod like a regular function.

Read how Data-Oriented Programming: Reduce software complexity explains multiple dispatch →

Related concepts

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.