[swift-evolution] [Proposal draft] Conditional conformances

Joe Groff jgroff at apple.com
Tue Sep 27 11:52:31 CDT 2016

> On Sep 26, 2016, at 5:37 PM, Robert Widmann via swift-evolution <swift-evolution at swift.org> wrote:
> +1.  I have one purely bureaucratic concern that I couldn't quite find answers to on a read through:
> Orphan instances and more generally cross-module uniqueness of instances are not mentioned.  What's the policy here?  Are we locally unique with respect to imported modules or globally unique with respect to all importable modules?

We fundamentally can't guarantee cross-module uniqueness of instances, since we allow arbitrary post-hoc conformance. For the most part, we don't have to, since most operations that require a protocol conformance are able to statically select one at compile-time, and the conformance becomes an implicit part of the parameterization of any generic functions or types that require it. The main problem overlapping conformances pose is for dynamic casts, since the 'x as? P' operation has no static context by which to pick a conformance if there are multiple possibilities for the dynamic type of x to conform to P.


More information about the swift-evolution mailing list