Single Dispatch is a historical design pattern.

?Years Old
  • Single Dispatch does not currently rank in our top 50% of entities I track
  • I have 14 facts about Single Dispatch. what would you like to know? email me and let me know how I can help.
  • Read more about Single Dispatch

Languages with Single Dispatch include common-lisp, cpp, java, javascript, objective-c, python, swift

Example from common-lisp:

; https://eli.thegreenplace.net/2016/a-polyglots-guide-to-multiple-dispatch-part-3/
(defclass Person () ())
(defmethod frobnicate ((p Person) record spreadsheet)
 (format t "~a ~a ~a~&" (type-of p) (type-of record) (type-of spreadsheet)))
(defclass Asteroid () ())
(defmethod frobnicate ((a Asteroid) velocity size)
 ; do stuff
 )
; At runtime these 2 would be routed to respective methods:
(frobnicate a-person his-record big-spreadsheet)
(frobnicate an-asteroid very-fast pretty-small)

Last updated September 6th, 2019