<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 25, 2016, at 3:37 PM, William Shipley via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">The Swift 2.2 manual says:</div><div class=""><br class=""></div><div class=""><div class="note" style="background-color: rgb(249, 249, 249); border-width: 0px 0px 0px 5px; border-left-style: solid; border-left-color: rgb(233, 233, 233); font-size: 1.2em; margin: 30px auto 35px; outline: 0px; padding: 15px 15px 7px; vertical-align: baseline; width: 581.390625px; font-family: Helvetica, Arial, sans-serif;"><aside class="aside"><p class="aside-title" style="background-color: transparent; border: 0px; font-size: 9px; margin: 0px 0px 8px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); letter-spacing: 2px; text-transform: uppercase; background-position: initial initial; background-repeat: initial initial;">NOTE</p><p class="para" style="background-color: transparent; border: 0px; font-size: 0.75rem; margin: 0px 0px 8px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(65, 65, 65); line-height: 17.399999618530273px; background-position: initial initial; background-repeat: initial initial;">Strictly speaking, you can write a custom class that conforms to <code class="code-voice" style="background-color: transparent; border: 0px; font-size: 0.9em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-family: Menlo, monospace; word-wrap: break-word; background-position: initial initial; background-repeat: initial initial;">CounterDataSource</code> without implementing <em style="background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class="">either</em> protocol requirement. They are both optional, after all. Although technically allowed, this wouldn’t make for a very good data source.</p></aside></div></div>I think it’d be helpful to get a compiler warning when you declare that a class or struct complies to a protocol (that only has optional methods) but doesn’t actually implement any of the protocol.<div class=""><br class=""></div><div class="">E.G., this show show a warning:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Cocoa</span></div><div style="margin: 0px; line-height: normal; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> kindaUseless: </span><span style="font-variant-ligatures: no-common-ligatures" class="">NSObject</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures" class="">NSTableViewDelegate</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class="">}</div></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div><div class="">While this behavior is mathematically consistent, it’s not rational and doesn’t really fit in with Swift.</div><div class=""><br class=""></div><div class="">Extraneous protocol conformance is messy and I can’t imagine a scenario in which it’s actually useful.</div><div class=""><br class=""></div><div class="">Thoughts?</div></div></div></div></blockquote></div><div><br class=""></div><div>It should be a straightforward compiler warning to add. Want to file a bug at <a href="http://bugs.swift.org" class="">bugs.swift.org</a>? It would make a good starter bug.</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div><br class=""></div><br class=""></body></html>