I'm not sure if my analysis here is correct, and would love feedback.
I work on a large Swift project with a complex dependency graph. In this project I ran into an issue where one module had extension of
RawRepresentable where RawValue == String with a single method. I believe this resulted in all
enums in modules which transitively depended on the extending module having an entry for this custom function in their witness tables. The outcome of this was the transitive dependency became a direct dependency of all of those modules (I noticed this when trying to build the project as dylibs).
I can kind of see why this is the case, and it makes sense though it may be problematic. The ship has probably sailed on disallowing this for core protocols like
RawRepresentable, but I wonder if there would be value in having an attribute which would disallow other modules from writing an extension to a protocol unless that extension is qualified by a protocol or type which is defined by that module (I have no idea what to call it,
@disallowExternallyQualifiedExtensions?). I'm curious to hear other people's thoughts on this.