Yes, as said this is a feature that was discussed in the past, I believe. I only dimly remember, but there were ideas to use ::
to specify the module somehow when invoking a function on a type, but I can't exactly recall and there are several downsides to this I think.
It's one of those things that on first glance seem simple, but come with quite a few quirks.
For example, what do you specify? Just the module? Or the type/extension, like in a java package or some other namespace? The latter poses the question: What does that mean for extensions? They're not really a "thing" other than markers in the syntax unlike a full type (or existential). Remember the pains we had to endure before we got any
.
In this case here somehow specifying the module would be sufficient, but it's harder to come up with some good syntax for that than a bad one, I believe:
let myView = MyView()
let paddedWithPaddingFromModuleA = myView.ModuleA::padding(EdgeInsets())
Could be one example, but this reads quite ugly to me... the module specifier is in the middle, but of course the relevant type information comes from the myView
variable, which is in front of it... so ... = ModuleA::myView.padding(EdgeInsets())
? That somehow looks like myView
belongs to the module, which it kind of doesn't, as it's a variable... whose type may come from yet another module...
I believe this has stopped the community from going forward with a fitting proposal so far, but an even more important reason is the relatively limited applicability:
As I said above, this does not give you the mechanic to make views you don't write yourself behave in any other way. Which then boils down to just a matter of aesthetics: How terrible is it that I cannot name my function the same as one from an existing framework? Since you must specify wich method to call anyway, just use a name that does not collide.
The only other use case that remains for specifying an instance's function that comes from extensions of two different modules is probably pretty rare: You imported two foreign modules into your code that define the exact same method. While this can happen (I guess), there are ways to work around this (splitting up code into different files/modules, writing shims), so the only real benefit for being able to specify the module is convenience.
Of course, it would still be a nice-to-have. Whether a form of swizzling like in Objective-C is really desirable I don't know... I always found the way e.g. Firebase "magically" invaded frameworks you rely on to do "inject" behavior fishy and intransparent... (and I remember there was once even a legal issue with it basically activating something ad identifier related without you as a coder knowing...).