<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=""><div><blockquote type="cite" class="">This should be resolved when <a href="http://article.gmane.org/gmane.comp.lang.swift.evolution/3082" class="">PwS </a>(Protocol with Storage) get alive:<br class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class=""><span style="line-height:21.6667px" class=""> // Framework land</span><br style="line-height:21.6667px" class=""><span style="line-height:21.6667px" class=""> public protocol DatabaseRecord {</span></div><div dir="ltr" class=""><div class=""> internal extension DatabaseRecord {</div></div><div dir="ltr" class=""><div class=""><div style="line-height:21.6667px" class=""><span style="line-height:21.6667px" class=""><b class=""> var referenceRow: DatabaseRow</b></span></div><div class=""><span class="" style="line-height: 21.6667px;"> </span><span class="" style="line-height: 21.6667px;">public</span><span class="" style="line-height: 21.6667px;"> </span><span class="" style="line-height: 21.6667px;"> </span><span class="" style="line-height: 21.6667px;">extension DatabaseRecord {</span></div></div></div></div></div></blockquote><div><br class=""></div>Yay for visibility and storage in protocols, and generally for being able to provide a different API to the implementers of the protocol compared to the clients of the protocol.</div><div><br class=""></div><div>But.</div><div><br class=""></div><div><blockquote type="cite" class="">So explain to me: if this code worked:<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>protocol ActivityViewControlling: UIViewController {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>func retrieveText() -> String<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>extension ActivityViewControlling {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>@IBOutlet var messageLabel: UILabel!<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>override func viewWillAppear(animated: Bool) {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>super.viewWillAppear(animated)<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>messageLabel.text = retrieveText()<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>}<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}<br class=""><br class="">What would you feel was missing compared to this?<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>abstract class ActivityViewController: UIViewController {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>abstract func retrieveText() -> String<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>@IBOutlet var messageLabel: UILabel!<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>override func viewWillAppear(animated: Bool) {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>super.viewWillAppear(animated)<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>messageLabel.text = retrieveText()<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>}<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}<br class=""></blockquote><div><br class=""></div>For all intents and purposes, you made an abstract class here, but calling it a protocol. </div><div><br class=""></div><div>It has advantages:</div><div><br class=""></div><div>+ you can achieve multiple inheritance that way</div><div>+ ... hm? what else?</div><div><br class=""></div><div>and disadvantages:</div><div><br class=""></div><div>+ it's still, for all intents and purposes, an abstract class, but for some reason you're now calling it a protocol — THAT'S confusing, if you ask me; now there's two kinds of protocols, the normal ones and the ones that do magic stuff when you implement them (I personally think those latter thingies should be called mixins)</div><div>+ it has additional limitations (I don't think you can call super, which is often very useful)</div><div>+ it's a concept that doesn't work or exist, and there's no telling if it'll be a part of Swift 3 or not</div><div><br class=""></div><div>I believe we're confusing conceptual and implementation details here. Conceptually, both approaches seem to be using two different names for the same thing; I don't really care if the functionality I need comes through a supercharged protocol or a slightly enhanced class.</div><div><br class=""></div><div>Are we really discussing anything more than a name? If yes, what is it?</div><div><br class=""></div><div>Implementation-wise, the compiler can always translate abstract classes into protocols internally, so I don't really see the implementation difference as important.</div><div><br class=""></div><div>A.</div><div><br class=""></div></body></html>