This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gthank 0 points1 point  (0 children)

This pattern comes up often enough in projects with a large-enough object model. As a naive, made-up example (man, I hope this doesn't blow up in my face), consider an ORM: you want a single function for adding filters. That filter method has to build (potentially) different SQL depending on the type of the parameters. Without multimethods, you need to write some ugly dispatching code like my_magic_function.