2 ms·
Double-dispatch seems to be equivalent to Haskell's pattern matching. Since Haskell does not have sub-typing, everything has the same runtime type. However, yo
by tikhonj 14y ago
Double-dispatch seems to be equivalent to Haskell's pattern matching.
Since Haskell does not have sub-typing, everything has the same runtime type. However, you can easily combine different types into a single algebraic data type and then dispatch by pattern matching against that type.
This probably isn't exactly the same as double-dispatch in other languages, but it seems to be very similar and to serve the same purpose.