<div dir="ltr"><div>The disadvantage is that it's easy in Swift to push millions of things in protocols, and end up with:<br></div><div><br></div><div> class MyClass: SwiftProtocollable, MoreFunctionalityable, MoreHereable, StillMoreable, ThisTooable, StillMoreable {</div><div> ...</div><div> } <br><div><br></div><div>Given enough thought, maybe this can be avoided, but the problem is (as far as I can tell, and I may be out to lunch) that protocols are philosophically the "correct" way in Swift to do a lot of things.<br></div><div><br></div><div>I recently wrote a tiny framework for Drag n Drop, and I wound up with various combinations of almost 10 protocols - and, afai could tell, that was "correct" because I was specifying the different abilities of my classes (eg: do they have methods for reading text data, file data, writing promises, reading promises, etc) It's just not easy to read.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 14, 2016 at 4:10 PM, Benjamin Spratling 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">Given optionals and closures, is it necessary to support optional protocols?<br>
<br>
protocol MyProtocol {<br>
var titleForRow:((_ indexPath:IndexPath)->(String)<wbr>)? { get }<br>
}<br>
<br>
One disadvantage is that you need Obj-C, which means it doesn’t run on linux, or several other platforms.<br>
Another disadvantage, as I understand it, is it requires slower Obj-c dispatch, instead of witness tables. Obj-C dispatch also only considers names, not argument & return types.<br>
<br>
> On Nov 14, 2016, at 5:48 PM, Rick Mann via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
> Will Swift ever support optional methods without @objc?<br>
><br>
> What are the disadvantages of marking a protocol @objc?<br>
><br>
> Thanks!<br>
><br>
> --<br>
> Rick Mann<br>
> <a href="mailto:rmann@latencyzero.com">rmann@latencyzero.com</a><br>
><br>
><br>
> ______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
</blockquote></div><br></div></div>