4 ms·
Dispatch ambiguity can really bite you, particularly if you start extending methods from other packages. An issue I often run into at the same time as method am
by arksingrad 4y ago
Dispatch ambiguity can really bite you, particularly if you start extending methods from other packages. An issue I often run into at the same time as method ambiguity is a stack overflow from self-calling constructors. If you try to define an outer constructor with default arguments, it's really easy to end up just calling that constructor from itself.
The metaprogramming trick for defining a set of methods at once is useful, but I wish there were a more compiler-level solution to sorting out ambiguities or determining what's more "specialized".
These don't really color my view on multiple dispatch, however. I find it to be a really useful tool and I don't run into dispatch issues very frequently. If you're meticulous about your typing it's usually easy to avoid these pitfalls, but sometimes they still crop up.