I'm +1 on this. It seems like it would solve the issue of Objective-C APIs losing their protocol conformances on properties/arguments/return values when they're added to a class, like UIView<SomeProtocol>. That always seemed like a major hole in the cross-language support and when writing ObjC libraries I've had to explicitly use id<Foo> instead of a stronger class-based type simply to ensure Swift interoperability.<br><br>The other option of course is to import those things as generic functions with constraints, but (1) that doesn't solve it for properties, and (2) if we already support composing protocols in this way, why not also allow it for other types, where it can be used for properties and variables? This approach feels like it would round out the type system nicely.<br><br><br><div class="gmail_quote"><div dir="ltr">On Thu, May 12, 2016 at 7:09 AM Adrian Zubarev via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><span style="font-family:'helvetica Neue',helvetica">protocol<SomeRealClass, SomeProtocol> </span></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><span style="font-family:'helvetica Neue',helvetica">protocol<SomeRealStruct, SomeProtocol> </span></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><span style="font-family:'helvetica Neue',helvetica"><br></span></div><div style="margin:0px"><span style="color:rgb(0,0,0);font-family:'helvetica Neue',helvetica;font-size:13px">This feels really odd to me. </span></div><div style="margin:0px"><span style="color:rgb(0,0,0);font-family:'helvetica Neue',helvetica;font-size:13px"><br></span></div><div style="margin:0px"><span style="color:rgb(0,0,0);font-family:'helvetica Neue',helvetica;font-size:13px">`type<</span><span style="color:rgb(0,0,0);font-family:'helvetica Neue',helvetica;font-size:13px">SomeRealClass, </span><span style="color:rgb(0,0,0);font-family:'helvetica Neue',helvetica;font-size:13px">SomeProtocol</span><font face="helvetica Neue, helvetica">>` is more clear I’d say.</font></div><div style="margin:0px"><font face="helvetica Neue, helvetica"><br></font></div><div style="margin:0px"><font face="helvetica Neue, helvetica">I think this would be a good </font><span style="font-family:arial,sans-serif;white-space:nowrap">addition to the type system and allow us to build more complex and type save code.</span></div><div style="margin:0px"><span style="font-family:arial,sans-serif;white-space:nowrap"><br></span></div><div style="margin:0px"><font face="arial, sans-serif"><span style="white-space:nowrap">But still I’d love to discuss if there might be any disadvantages to this feature.</span></font></div></div><div style="word-wrap:break-word"> <br> <div><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br></div><div style="word-wrap:break-word"><p>Am 12. Mai 2016 bei 15:11:00, Vladimir.S (<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a>) schrieb:</p> <blockquote type="cite"><span><div><span style="color:rgb(0,0,0);font-family:'helvetica Neue',helvetica;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">protocol<><span> </span></span></div></span></blockquote></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>