<div dir="ltr">I'm somewhat convinced with Maximilian<div><br></div><div>for<br><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px"><b><i>protocol<MyProtocol where Self: UIViewController></i></b></span><br></div><div><br style="font-size:13px">Brent also has a valid point of having at least one class type in the protocol</div></div><div><br></div><div>protocol<OneClass, OtherProtocol, SomeProtocol></div><div><span style="font-size:13px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 10:56 PM, Jordan Rose via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Feb 10, 2016, at 5:00 , Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
>> So, I definitely think there is room for improvement here… how about recycling the inheritance syntax?<br>
>><br>
>> let controller: (UIViewController, UITableViewDatasource)<br>
><br>
> This declares a tuple containing a UIViewController and a UITableViewDataSource.<br>
><br>
>> I added the braces because it would be really when you add the question mark for an optional value; an alternative for this case would be<br>
>><br>
>> let controller: Optional<UIViewController, UITableViewDatasource><br>
><br>
> This attempts to declare an optional with two generic types, which doesn't work because Optional only has one type parameter. (But other types, like Dictionary, *do* take two type parameters.)<br>
><br>
> Swift does already have a syntax for declaring that a type must conform to two (or more!) protocols:<br>
><br>
> let controller: protocol<UITableViewDataSource, UITableViewDelegate><br>
><br>
> I think this could probably be extended to support one class type as well, perhaps with a new name:<br>
><br>
> let controller: all<UIViewController, UITableViewDataSource><br>
<br>
</span>We've been calling it "any" or "Any" (as in "any instance that is-a UIViewController and is-a UITableViewDataSource"), but I think this is the direction we've been talking about over here.<br>
<br>
(Not that syntax bikeshedding can't still be useful.)<br>
<br>
Jordan<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><font color="#666666">Best regards,</font><div><font color="#666666">Inder Kumar Rathore</font></div></div></div>
</div>