<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="">2016/07/16 21:37、Jean-Daniel Dupas &lt;<a href="mailto:mailing@xenonium.com" class="">mailing@xenonium.com</a>&gt; のメール:</div><br class="Apple-interchange-newline"><div class=""><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=""><blockquote type="cite" class=""><div class="">Le 16 juil. 2016 à 00:31, Andre Elder 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 dir="auto" class=""><div class=""><span class=""></span></div><div class=""><div class=""><span class=""></span></div><div class=""><div class=""><span class=""></span></div><div class=""><div class="">2016/07/15 16:37、Riley Testut via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; のメッセージ:</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class="">FWIW, I'm still against this proposal, but since it will be accepted regardless, here are my thoughts:</span><br class=""><span class=""></span><br class=""><span class="">• Open keyword is significantly better.<span class="Apple-converted-space">&nbsp;</span></span><br class=""><span class="">• Members should be *open* by default, and final should be opt-in. If you're opening up a class for subclassing, my gut says you should allow the client to do as they wish.</span><br class=""></div></blockquote><div class="">If you have a class that was not open yet, just making it open wouldn't expose any members: it would then just be subclassable.</div><div class=""><br class=""></div><div class="">If the act of making the class open doesn't implicitly make overriding possible, well all you can do then is add methods, and that can be done with extensions anyways, so it's not as useful and makes the<span class="Apple-converted-space">&nbsp;</span><i class="">public open class {}</i><span class="Apple-converted-space">&nbsp;</span>pattern<span class="Apple-converted-space">&nbsp;</span><i class="">just</i><span class="Apple-converted-space">&nbsp;</span>by itself not so useful imho... 😬</div><div class=""><br class=""></div><div class="">Also, the keyword 'open' itself may imply 'hey I'm open, please do what you want with my public members', whereas 'subclassable' is more specific in intention... &nbsp;(but that's just me, so n=1 and all that)</div><div class=""><br class=""></div><div class="">TLDR; +1 to the above: simpler is better and defaulting to overridable for public members on an open class is simpler... invariants can be protected by the 'final' keyword.</div><div class=""><br class=""></div><div class="">If we were to default to non-overridable, a more consistent 'open' on the method is preferred over overridable for me... open class, open method... much better imho...</div></div></div></div></div></div></blockquote><br class="">Do we really need an open keyword ?<div class=""><br class=""></div><div class="">As already said, if open does nothing more than allowing the class to be subclassed, why not simply make the class subclassable if it contains at least one overridable member ?</div></div></div></blockquote><div>Thats a good point actually… but looks like Review #2 has already started… and 'open' is available for both class and method there… I suppose its the whole "default to safe", just in case someone made one method 'open' they may not have intended to actually make the whole class open… (also see below)</div><br class=""><blockquote type="cite" class=""><div class=""><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=""><div class=""><div class="">In case we require an open keyword, what would happen if someone mark a member overridable, but does not make the class open ? Will the compiler emit an error, or make the class implicitly «&nbsp;open&nbsp;» ?&nbsp;</div></div></div></div></blockquote></div>In proposal #2 looks like it would generate an error, but Xiaodi Wu has said that it should be allowed and not generate an error per&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md" class="">SE-0025</a>.<br class=""><div class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md#complications-with-private-types" class=""></a><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md#complications-with-private-types" class="">Take a look at</a>: "The compiler should not warn when a broader level of access control is used within a type with more restrictive access, such as&nbsp;internal&nbsp;within a&nbsp;private&nbsp;type."<div class=""><br class=""></div><div class="">- Andre</div></div></body></html>