Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Multiple Dispatch

< >
Example from 1 languages: 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 1 languages: 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, Elixir, Speedie

*

View all concepts with or missing a hasMultipleDispatch measurement

*

Read more about Multiple Dispatch on the web: 1.

- Build the next great programming language Add Issues About Search Keywords Livestreams Labs Resources Acknowledgements