The qualified operator lookup syntax does not solve the overload ambiguity problem. Qualified name lookup for non-operators does not solve that problem either. Thus I think overload ambiguity is almost entirely orthogonal to the operator member syntax proposed here.
There are two reasons qualified operator lookup is desirable:
-
This always seems like a missing feature, because qualified reference to a static non-operator member is already possible.
let f = Float.maximum // (Float, Float) -> Float let g = Float.+ // error, but why not?
-
It improves clarity for potential language features that retroactively provide a behavior to an existing method. This includes dynamic replacement and differentiable programming.
@dynamicReplacement(for: Foo.+) func +(_: Foo, _: Foo) -> Foo { ... } @derivative(of: Foo.+) func derivativeOfAdd(_: Foo, _: Foo) -> (value: Foo, differential: (Foo, Foo) -> Foo) { ... }