<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>Hi Gor,</div><div><br class=""></div><div>[I'll continue to answer below, but that wont help you with your proposal…]</div><div><br class=""></div><div>The question is wether this</div><div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><font color="#b92d5d" class="">protocol</font> <font color="#4f7a28" class="">Equatable</font> {</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><font color="#b92d5d" class="">static</font> <font color="#b92d5d" class="">func</font> == (_ some: <font color="#b92d5d" class="">Self</font>, _ other: <font color="#b92d5d" class="">Self</font>) -> <font color="#4f7a28" class="">Bool</font></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><font color="#b92d5d" class="">default</font> <font color="#b92d5d" class="">static</font> <font color="#b92d5d" class="">func</font> != (_ some: <font color="#b92d5d" class="">Self</font>, _ other: <font color="#b92d5d" class="">Self</font>) -> <font color="#4f7a28" class="">Bool</font></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">}</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><font color="#b92d5d" class="">extension</font> <font color="#4f7a28" class="">Equatable</font> {</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></font><font color="#b92d5d" face="Menlo" class="">static</font><span class="" style="font-family: Menlo;"> </span><font color="#b92d5d" face="Menlo" class="">func</font><span class="" style="font-family: Menlo;"> != (_ some: </span><font color="#9a244f" class="" style="font-family: Menlo;">Self</font><span class="" style="font-family: Menlo;">, _ other: </span><font color="#9a244f" class="" style="font-family: Menlo;">Self</font><span class="" style="font-family: Menlo;">) -> </span><font color="#4f7a28" face="Menlo" class="">Bool</font><font face="Menlo" class=""> {</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span><b class="">[<font color="#4d22b3" class="">Your Code Here]</font></b></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">}</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div></div><div>is better than</div><div><br class=""></div><div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><font color="#b92d5d" class="">protocol</font> <font color="#4f7a28" class="">Equatable</font> {</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><font color="#b92d5d" class="">static</font> <font color="#b92d5d" class="">func</font> == (_ some: <font color="#b92d5d" class="">Self</font>, _ other: <font color="#b92d5d" class="">Self</font>) -> <font color="#4f7a28" class="">Bool</font></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></font><font color="#b92d5d" face="Menlo" class="">static</font><span class="" style="font-family: Menlo;"> </span><font color="#b92d5d" face="Menlo" class="">func</font><span class="" style="font-family: Menlo;"> != (_ some: </span><font color="#9a244f" class="" style="font-family: Menlo;">Self</font><span class="" style="font-family: Menlo;">, _ other: </span><font color="#9a244f" class="" style="font-family: Menlo;">Self</font><span class="" style="font-family: Menlo;">) -> </span><font color="#4f7a28" face="Menlo" class="">Bool</font><font face="Menlo" class=""> {</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span><b class="">[<font color="#4d22b3" class="">Your Code Here]</font></b></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">}</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font class="">I don't think so, and therefore, I don't want to add a new keyword (or, more precise, a new meaning for an existing keyword).</font></div></div><div>Both solutions could coexist, but I doubt that implementation inside protocol body leaves enough room for "default func".</div><div><br class=""></div><div>- Tino</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="">Fileprivate has been there for years, it just was called private — and because the "church of extensions" ;-) has been so powerful, we finally ended up with what we have now.</div></div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Yes, I was here. The fact that we started off with private behaving the way it does now is history now. The point stands: extensions in the same file as the type definition have an extra guarantee that enable the compiler to provide extra features based on that: the guarantee that the extension and the type definition will always be visible simultaneously, thus, implicitly merging the extension into the type definition is possible. It's not possible to do in any other way, because a file is the only unit of compilation that's more-or-less guaranteed to be atomically parsed. A module is separated into files, which can be compiled into objects separately, making it impossible for the compiler to know if any extension in any of the other files will change the layout of the type.</div></div></div></div></blockquote><div>The compiler won't care where if a method is defined in the type declaration, or in an extension in the same file.</div><div>What extra guarantee could those extensions offer?</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="">They are recommended in style guides, influencers blog about them, and they motivated a ridiculous complex change in the access rights system. Yet I haven't seen any evidence that they offer real benefit.</div></div></div></div></div></blockquote><div class=""><br class=""></div><div class=""><div class="">Extensions are a tool for decentralizing code. There are some critical limits on extensions that make main type definition subject to unavoidable bloating (required and designated initializers, stored properties, the deinitializer, and open methods), but everything else is a prime candidate for decentralizing. Putting as little code as possible into the type definition and semantically grouping the implementation into extensions improves readability and maintainability dramatically.</div></div></div></div></blockquote><div class="">The thing is: This is just a claim that gets repeated over and over. There is no proof, and I even don't know a single study on that topic.</div></div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Take a look at this article: </span><a href="https://en.wikipedia.org/wiki/Separation_of_concerns" class="">https://en.wikipedia.org/wiki/Separation_of_concerns</a></div></div></div></blockquote><div>There's nothing about Swift, neither about extensions, in this article.</div><div>I don't want to start throwing around buzzwords, but there's also <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself" class="">https://en.wikipedia.org/wiki/Don%27t_repeat_yourself</a></div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="">Extensions are great for adding useful helpers to existing types, and still allow you to selectively expose details of your own classes — but most people seem to ignore those options and focus on something can be done better with plain old comments.</div></div></div></div></div></blockquote><div class=""><br class=""></div>Relying on comments for invariants and preconditions is a poor design decision, because there's no way of enforcing them and the whole integrity of the code is thrown at the mercy of a human's carefulness (which is a horrible fate to befall upon any code). By writing the code in such a way that makes it impossible to be misused (by way of compiler enforcement), the code becomes resilient and no amount of clumsy usage can lead to incredibly obscure bugs that would take a week of debugging to catch.</div></div></blockquote><div class="">But extensions are no tool to do so: They have no features that offer any protection, exactly like comments — they are just more typing and don't show up properly in Xcode.</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">import</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>UIKit</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">class</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>MyViewController:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UIViewController</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">extension</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">MyViewController</span><span class="" style="font-variant-ligatures: no-common-ligatures;">:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">UITableViewDataSource</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">_</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UITableView</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, numberOfRowslnSection:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Int</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) -><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Int</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">return</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">1</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">_</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UITableView</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, didSelectRowAt:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">IndexPath</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">print</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-variant-ligatures: no-common-ligatures;">"Hu, isn't this a delegate method?"</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">extension</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">MyViewController</span><span class="" style="font-variant-ligatures: no-common-ligatures;">:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">UITableViewDelegate</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">_</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UITableView</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, numberOfRowsInSection:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Int</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) -><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Int<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">{</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">return</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">99</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">_</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>tableView:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UITableView</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, cellForRowAt indexPath:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">IndexPath</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) -><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UITableViewCell</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>cell =<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UITableViewCell</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(style: .</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">default</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, reuseIdentifier:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(209, 47, 27);">""</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> cell.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">textLabel</span><span class="" style="font-variant-ligatures: no-common-ligatures;">?.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">text</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>=<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">"I should get my data from a datasource"</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">return</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>cell</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div></div><div class=""><br class=""></div><div class="">This is perfectly valid Swift, and it is build on extensions — but does it increase the quality of the code?</div><div class="">Same file extensions are nothing but a different pair of parenthesis to surround your code, and since Swift 4, you can shuffle around those delimiters however you like, and it has still the same meaning for the compiler.</div><div class="">They enforce nothing, and so far, I haven't seen any ideas to increase their power.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">The compiler also doesn't stop you from making a wide variety of design choices, a comprehensive list of which can be found here: <a href="https://en.wikipedia.org/wiki/Anti-pattern#Programming" class="">https://en.wikipedia.org/wiki/Anti-pattern#Programming</a></div><div class="">For instance, have you tried reading the implementation of sin function in glibc? It's a very thick spaghetti code, sprinkled with a bucketful of magic numbers. It's absolutely impossible to comprehend.</div><div class=""><br class=""></div><div class="">Any language limitation should only be implemented if it passes the threshold where the gain of safety and convenience outweighs the loss of flexibility and the cost of implementing the limitation.</div><div class="">In your example, the gain of convenience is much lower than the cost of implementing it and loss of flexibility.</div></div></div></div></blockquote><div>What?</div><div>I didn't talk about adding limitations, and my example just shows that that "extension-oriented programming" doesn't add safety, just like comments — simply because the compiler strips both kinds of decoration.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="">[sorry for the rant — but I think a critical look at extensions is long overdue: I rarely see someone questioning their role, so basically, we are making important decisions based on pure superstition]</div><div class=""><br class=""></div><div class="">A protocol itself is already a vehicle to group related methods,</div></div></div></div></div></blockquote><div class=""><br class=""></div>A protocol is a vehicle for generic programming and separation of abstractions.</div></div></blockquote><div class="">True — but does that stop a protocol from being a way to group related methods?</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Protocols are not free. They come at a cost of wrapping the object in an existential container and make indirect calls via the witness table. Extensions on value types are free.</div></div></div></div></blockquote></div>All true — but not an answer to the question ;-)<div class=""><br class=""></div></body></html>