That's not actually the model I suggest we use. As I see it, there are two aspects to type
- Nominal type identity, e.g. “
Swift.Set<A.X>
” or “A.X
” (whereA
is a module) - Conformance set, e.g. {how
A.X
conforms toHashable
, howSwift.Set<A.X>
conforms toEquatable
}
When code expresses a requirement that two types are the same, it means:
- the nominal type identities are equal
- the conformance sets are non-conflicting
Two conformance sets conflict when they indicate the same nominal type conforms to a given protocol in two different ways.
In this model,
- In your example, the conformance of
String
toP
in my own module does not prevent anArray<String>
created there from interoperating with any other APIs. - In my example, you could call
doSomething()
on the value produced byB.uniqueXs
, but only by passing it through a context (module) whereX
does not conform toEquatable
, and thus the concept of “uniqueX
s” has no meaning.
This model generalizes to scoped conformances this way for your example: if P
is public but String: P
is internal, another module could declare a different String: P
conformance. Only then would that module's APIs involving String
become incompatible with those from the module where the first conformance was defined.