|
|
|
|
|
by naasking
3696 days ago
|
|
> we should not be conflating dynamic dispatching code which could be statically resolved from dynamic dispatching code which is necessarily dynamic. This is exactly what I said: most of what people call "dynamic dispatching" is not truly dynamic, and the use of dispatching code is merely an implementation detail. > In Haskell, you do not do this sort of dispatch with typeclasses, but instead use ADTs. Except you can, and this is one way to solve the expression problem in Haskell, ie. by lifting constructors to their own types with pattern matching functions lifted to type classes. At which point we come full circle: most uses of ADTs can also be monomorphized and so are not dynamically dispatched either. Dynamic dispatches then occur only on input at runtime to select the type being instantiated (and so the type class being dispatched into). |
|