4 ms·
I can't see a relationship between polymorphism and structural pattern matching. Both could be label "dynamic dispatch", but the mechanism is very different. Wh
by beza1e1 17y ago
I can't see a relationship between polymorphism and structural pattern matching. Both could be label "dynamic dispatch", but the mechanism is very different. While polymorphism can be implemented efficiently via vtables, i don't know of a method to this with general pattern matching.
Vtables means just one indirection thus no more than one more memory access. Pattern matching is like parsing.
- scott_s 17y agoThere's a relationship in the sense that they can both be used to solve the same problem, and it's possible to write a function that generates one from the other.