I know you think that I am bringing up the ADL thing completely out of context, but I am not. Reread the âproblems this addressesâ at the beginning of the thread, and you will see that these are exactly the same issues that keep popping up. In particular, the problems (1) and (2) are exactly the typical issue of namespaces and type piracy, which I hope I donât need to repeat.
Problem (3) the poster points out (the difficulty of compiling due to all sorts of merging into the Base
namespace) is exactly what is fixed by an ADL based approach. With ADL, noone ever has to stick anything in the Base
namespace. In fact, you could even ban it if you wanted for compilable code and it would be completely practical. Furthermore, it would be completely practical for all packages to be written without any using
s at all, which would make them easier to coexist. This is how things work in the best example of a compiled programming language with multi-argument generic programming (i.e. C++) that has proper namespaces.
Now, I personally donât agree with the proposed approach to solving the issues, but this comes down to the same ultimate problem which keeps rearing its head and causing immeasurable âinkâ to be spilled. Please take the persistence of peopleâs questions, the fact that so many posts on discourse end up with the same basic problem, and the fact that there are all sorts of hacky macros proposed as a signal that there is something deeper to be considered between major versions. Donât assume this is just about educating people unused to working with generic programming and multi-argument functions.
No, that is not the essence of the issue, and I think it is much more subtle and pervasive than you realize. The way that Julia does lookups is not a natural consequence (in any way) of multiple dispatch. If multiple-dispatch is the natural generalization of single-dispatch, then what Julia does is not the natural generalization of namespaces under multi-dispatch. It may have its own self-consistent logic (which apparently is a lisp worldview), but it has nothing to do with generic programming with multi-argument functions.
In single-dispatch languages, the basic lookup rule is that whatever the namespace of the type you use as the first argument determines the relevant set of methods for a given function. The natural generalization of this is that with multi-dispatch, is that the namespaces of the types you have as the arguments determines the relevant set of methods for a given function. This is exactly what ADL does. With that, you never need to mess around inside of the namespaces of other types or the base library, unless you are doing something truly dynamic and odd.
Would ADL break a bunch of existing code? Maybe none. Can ADL this be implemented with a dynamic language and first-class functions? I am not sure, and implementation details matter. But there is a big difference between telling people âthis is how just you do things with multi-dispatchâ vs. âthere are reasons that the obvious generalization of single-dispatch (i.e. ADL) cannot be implemented hereâ vs. âwe understand the perspective and the pain, we will revisit whether alternative lookup rules can fix pain points between major versions, and here is a well-documented macro approach to achieve merging in a way that is a manual way in the meantimeâ.