Hacker News new | past | comments | ask | show | jobs | submit login

In OOP, isn't that essentially just overloading? In many OO languages, you could write both of those lines as-is (with corresponding method bodies) and have valid code. They'll typically be treated as two separate methods that just happen to have the same name.



The main difference is that overloading is resolved at compilation time whereas multi methods are resolved at runtime.


No because multi-mthods don't have a self/this pointer as such, rather they are dispatched at runtime taking into account the actual types of each parameter.


In OOP, I think the closest equivalent would be the visitor pattern.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: