PLDB
Languages Features Creators Calendar CSV Resources Blog About Donate Add Language
GitHub icon

Multiple Dispatch

< >
Example from Julia:
collide_with(x::Asteroid, y::Asteroid) = ... # deal with asteroid hitting asteroid collide_with(x::Asteroid, y::Spaceship) = ... # deal with asteroid hitting spaceship collide_with(x::Spaceship, y::Asteroid) = ... # deal with spaceship hitting asteroid collide_with(x::Spaceship, y::Spaceship) = ... # deal with spaceship hitting spaceship
Example from Common Lisp:
(defmethod collide-with ((x asteroid) (y asteroid)) ;; deal with asteroid hitting asteroid ) (defmethod collide-with ((x asteroid) (y spaceship)) ;; deal with asteroid hitting spaceship ) (defmethod collide-with ((x spaceship) (y asteroid)) ;; deal with spaceship hitting asteroid ) (defmethod collide-with ((x spaceship) (y spaceship)) ;; deal with spaceship hitting spaceship )

Languages with Multiple Dispatch include Julia, Smalltalk, Common Lisp, Dylan

Languages without Multiple Dispatch include JavaScript, TypeScript, Elixir, Static Typescript

Read more about Multiple Dispatch on the web: 1.

HTML of this page generated by Features.ts

hasMultilineStrings.html 路 hasMultipleDispatch.html 路 hasMultipleInheritance.html

View source

PLDB - Build the next great programming language Search v2023 Day 157 Docs Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com