Multiple dispatch
summary
A JavaScript library that implements multiple dispatch by creating a generic function 'plus' then adding methods and calling it demonstrates that parameter types determine which implementation runs and that dispatch maps parameter types to methods. The claim is that multiple dispatch restores symmetry lost to single-dispatch this makes functions aware of type hierarchies and replaces visitor-pattern boilerplate with a visitor pattern as generic function and examples show it working in code and list languages that already support it.
AI-written summary · about
chapters (7)
- 0:00Start
- 0:15What is method dispatch?
- 0:49Dispatch: via an object or via a function Polymorphic method: dispatch via an object
- 1:45More than one parameter
- 1:56Adding methods to a generic function
- 2:37Benefits of multiple dispatch
- 3:57Languages with multiple dispatch
related talks
31mMONADS - CODING FUNCTIONALLY
20mFunctional JavaScript
35mAll-You-Can-Eat-Types: Monad Buffet
34mFunctional JavaScript for everyone
01h 03mFunctional Programming in JavaScript
52mJavaScript Design Patterns
35mFunctional programming and curry cooking in JS
06mBrian Lonsdorf (loop/recur) interviewed at Fluent 2014
