Re:Big Ideas from 8 Programming Languages
by rco8786 on Saturday September 10, 2022 @06:36PM
(#32795119)
Can someone more intelligent than me explain how multiple dispatch differs from function overloading?
[ Parent
| on HN ]
Re:Big Ideas from 8 Programming Languages
by MarkSweep on Saturday September 10, 2022 @06:47PM
(#32795176)
In function overloading, like in Java or C#, the method is picked at compile time based on the static types of the parameters. In multiple dispatch, the function is chosen at runtime based on the runtime type of the parameters.
Re:Big Ideas from 8 Programming Languages
by KenoFischer on Saturday September 10, 2022 @06:48PM
(#32795180)
Dynamic mutliple dispatch takes into account the dynamic type rather than the static type as you would in say-C++ style function overloading. The single dispatch equivalent is function overloading vs virtual calls.