2026-03-28 11:49 UTC
It’s funny how overloading (ad-hoc polymorphism) shares an interesting drawback with dynamic typing.
If you have overlapping overloads, in the sense that more than one choice can match some set of argument types at a call site, you better have really great test coverage, otherwise, if the compiler’s behavior ever changes, it can silently break runtime behavior that relied on that one specific overload being chosen there over another.
Another drawback is difficulty reading code; when I call f(x), it can be hard to tell which f() is going to run, unless you ask the compiler (at least you can do that though, which you cannot in general with a dynamic language).
Replies (0)
No replies.