> Yes. To cite some evidence, here are codebases I actively maintain:
>
> | codebase | private # |
> fileprivate # | ratio |
>
> |--------------------------------------------------------|-----------|---------------|-------|
>
> | "M" (proprietary) | 486 | 249
> | 2x |
>
> | "N"(proprietary) | 179 | 59
> | 3x |
>
> | NaOH https://code.sealedabstract.com/drewcrawford/NaOH
> <https://code.sealedabstract.com/drewcrawford/NaOH> | 15 | 1
> | 15x |
>
> | atbuild https://github.com/AnarchyTools/atbuild
> <https://github.com/AnarchyTools/atbuild> | 54 | 5
> | 11x |
>
> So from my chair, not only is the distinction useful, but scoped access
> control (private) is overwhelmingly (2-15x) more useful than fileprivate.
>
I don't question your numbers, but it's once again a statistic that has to be
taken with a grain of salt:
The only claim that is backed by the table is that private is used more often
in your sample — nothing less, but nothing more.
If private is really more useful, should we remove fileprivate instead?
When you do a survey among car owners how often they have used their airbag,
and how often the cigar lighter socket, I guess the latter number would be much
higher — but still, I'd rather keep something that will hopefully never be
used, but could save my life when it does its job.
Fact is, you can replace every occurrence of "private" with "fileprivate", and
your source would compile as before, whereas fileprivate saves us from a
"friend"-keyword.
Afaics, the only real argument for private/fileprivate hasn't been brought up
at all:
Current private is the only level that can be used to demonstrate access
control in playgrounds — but I doubt this justifies the confusion caused by it.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution