[swift-evolution] Protocol non-conformance clause

Thorsten Seitz tseitz42 at icloud.com
Fri Apr 29 10:10:09 CDT 2016


Just writing an extension for plain A without a where clause works.

-Thorsten 

> Am 29.04.2016 um 16:03 schrieb Erica Sadun via swift-evolution <swift-evolution at swift.org>:
> 
> Gmane is down as far as my browser is concerned and I haven't found anything by Googling.
> 
> Given the following:
> 
> protocol A {func foo()}
> protocol B {} // empty protocol
> 
> extension A where Self:B {
>     func foo() {
>         print("Self is B")
>     }
> }
> 
> // Works
> struct S1: A, B {}
> S1().foo()
> 
> Is there a way to produce a similar extension that exempts any type that conforms to B?
> 
> cc'ing in Wux because this is a direct response to a scenario he brought up yesterday.
> 
> -- E
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160429/b26cf71c/attachment.html>


More information about the swift-evolution mailing list