Measures Concepts
GitHub icon

Single Dispatch

Single Dispatch - language feature

< >
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)
Example from Speedie:
|| x = "str" || i = x.find("t")

Languages with Single Dispatch include Java, JavaScript, Python, C++, Swift, TypeScript, Objective-C, Elixir, Common Lisp, Cython, Speedie, Pizza, Oracle Java, Deesel, cooC, Real-Time Concurrent C

Languages without Single Dispatch include progsbase

This question asks: Does the method called depended on a single operand?

Read more about Single Dispatch on the web: 1.

HTML of this page generated by Features.ts

View source

- Build the next great programming language Search Add Language Features Creators Resources About Blog Acknowledgements Queries Stats Sponsor Day 605 feedback@pldb.io Logout