[swift-evolution] final + lazy + fileprivate modifiers

Matthew Johnson matthew at anandabits.com
Mon Feb 13 12:45:11 CST 2017


> On Feb 13, 2017, at 12:40 PM, Zach Waldowski via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I still haven't been convinced by this. What are these incredibly large files that people are dealing with, and why should a crucial feature of the language be built around servicing anti patterns?

I agree that it is usually better to avoid having files get too large.  But large is relative and subject.  My 27” iMac displays about 100 lines of code at a time in Xcode.  `private` can be useful any time you go much beyond that - it can help you know that you’re looking at all of the relevant code.  Files in the 5-600 line range are pretty common and `private` can become quite useful once you start getting to getting that many lines in a file.  Of course this is an opinion so your mileage may vary.

> 
> Zachary
> 
> On Mon, Feb 13, 2017, at 01:26 PM, William Sumner via swift-evolution wrote:
>> 
>>> On Feb 12, 2017, at 9:19 AM, David Hart via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> 
>>> 
>>> Fileprivate 
>>> 
>>> 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.
>> 
>> 
>> I find the “Motivation” section of SE-0025 convincing. Private/fileprivate allows for distinguishing between shared and hidden details among related code in a file. Not only is there benefit in knowing intent when reading, but there is also benefit in writing because the IDE won’t autocomplete hidden details. I work on large files I’m not the sole author of, so this is important to me.
>> 
>> Preston
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170213/8400810d/attachment.html>


More information about the swift-evolution mailing list