<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 12 Feb 2017, at 18:24, Chris Lattner <<a href="mailto:clattner@nondot.org" class="">clattner@nondot.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="">On Feb 12, 2017, at 8:19 AM, David Hart via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><div class=""><blockquote type="cite" class=""><b class="">Final</b><div class=""><div dir="auto" class=""><div class=""><div class=""><div class="">Can someone tell me what is the use of 'final' now that we have 'public' default to disallowing subclassing in importing modules? I know that 'final' has the added constraint of disallowing subclassing in the same module, but how useful is that? Does it hold its weight? Would we add it now if it did not exist?</div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">As Matthew says, this is still important.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><div class=""><div class=""><b class="">Lazy</b></div><div class="">This one is clearer: if Joe Groff's property behaviors proposal from last year is brought forward again, lazy can be demoted from a language keyword to a Standard Library property behavior. If Joe or anybody from the core team sees this: do we have any luck of having this awesome feature we discussed/designed/implemented in the Swift 4 timeframe?</div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Sadly, there is no chance to get property behaviors into Swift 4. Hopefully Swift 5, but it’s impossible to say right now.</div><br class=""><blockquote type="cite" class=""><div dir="auto" class=""><div class=""><div class=""><div class=""><b class="">Fileprivate</b> </div><div class=""><br class=""></div><div class="">I started the discussion early during the Swift 4 timeframe that I regret the change in Swift 3 which introduced a scoped private keyword. For me, it's not worth the increase in complexity in access modifiers. I was very happy with the file-scope of Swift pre-3. When discussing that, Chris Latner mentioned we'd have to wait for Phase 2 to re-discuss it and also show proof that people mostly used 'fileprivate' and not the new 'private' modifier as proof if we want the proposal to have any weight. Does anybody have a good idea for compiling stats from GitHub on this subject? First of all, I've always found the GitHub Search quite bad and don't know how much it can be trusted. Secondly, because 'private' in Swift 2 and 3 have different meanings, a simple textual search might get us wrong results if we don't find a way to filter on Swift 3 code.</div></div></div></div></blockquote><br class=""></div><div class="">I would still like to re-evaluate fileprivate based on information in the field. The theory of the SE-0025 (<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md</a>) was that the fileprivate keyword would be used infrequently: this means that it would uglify very little code and when it occurred, it would carry meaning and significance.</div><div class=""><br class=""></div><div class="">We have a problem with evaluating that theory though: the Swift 2->3 migrator mechanically changed all instances of private into fileprivate. This uglified a ton of code unnecessarily and (even worse) lead programmers to think they should use fileprivate everywhere. Because of this, it is hard to look at a random Swift 3 codebase and determine whether SE-0025 is working out as intended.</div><div class=""><br class=""></div><div class="">The best way out of this that I can think of is to add a *warning* to the Swift 3.1 or 4 compiler which detects uses of fileprivate that can be tightened to “private” and provide a fixit to do the change. This would be similar to how we suggest changing ‘var’ into ‘let’ where possible. Over time, this would have the effect of getting us back to the world we intended in SE-0025.</div></div></div></blockquote><div><br class=""></div><div>I’m 50/50 on this idea. If SE-0025 was the right decision, then this is a good suggestion. It will push people towards using <b class="">fileprivate</b> only when necessary. But it also has the consequence of biasing future stats towards the fact that SE-0025 was a good idea. For example, imagine we had introduced a <b class="">folderprivate</b> access modifier, and added a warning that pushed towards using <b class="">folderprivate</b> when <b class="">internal</b> was not necessary, it would give credit to <b class="">folderprivate</b> because we would see it in much more code: people just applying the fix-it. But it doesn’t mean anything about <b class="">folderprivate</b> being a good idea in the first place. Does that make sense?</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">-Chris</div><br class=""></div></div></blockquote></div><br class=""></body></html>