<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 Feb 21, 2017, at 11:29 PM, Charlie Monroe via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><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-stroke-width: 0px;"><div class="">On Feb 22, 2017, at 8:15 AM, Jean-Daniel via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">Le 21 févr. 2017 à 17:19, Tino Heth via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><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="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-stroke-width: 0px;">I’ll concede that the proposal makes a claim that might very well be disproved. I would very much like to see an actual example of a public class that **has** to be public but **shouldn’t** be open for obvious reasons. I would happily accept being shown wrong on that point.</div></div></blockquote></div>This is afaics one of the most active disputes on evolution — and you can save you a lot of grief by accepting that it is pointless:<div class="">The whole discussion isn't based on facts at all, despite many false claims that marking things as final is generally better.</div><div class="">I have asked for a single example to prove this in the past as well, so I guess no one can present such a thing to you.</div></div></div></blockquote></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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; 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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">To me, the largest purpose is when you have a root class ("abstract") and a few subclasses that represent various options - in Scala, this would be a case class. For various reasons, it can't be an enum - for example, you need a lot of stored data and an enum case a(Int, Int, Int, Bool, Int, Double) is not very usable.</div></div></div></div></blockquote><div><br class=""></div><div>What I have done for this case is have a protocol with several private conforming Structs, and then wrap it all in a public final class which wraps a boxed instance of one of the conformers.</div><div><br class=""></div><div>Here is some code:&nbsp;<a href="https://gist.github.com/jonhull/b9cd8a50abca16ea49eade2c91edf8a2" class="">https://gist.github.com/jonhull/b9cd8a50abca16ea49eade2c91edf8a2</a></div><div><br class=""></div><div>In this case, I chose to keep the protocol and associated init public so it could be extended… but they could have just as easily been private. The need for the type erasure hack should disappear with updated generics...</div></div><br class=""><div class="">Thanks,</div><div class="">Jon</div></body></html>