[swift-evolution] class/struct inner member access scope classifier
Jeremy Pereira
jeremy.j.pereira at googlemail.com
Tue Sep 27 03:34:18 CDT 2016
> On 26 Sep 2016, at 20:58, Ted F.A. van Gaalen via swift-evolution <swift-evolution at swift.org> wrote:
>
> Hello! Hope you are all OK!
>
>
> As far as I can see without binoculars, the “fileprivate” acces modifier
> could be dropped, were it not for source compatibility reasons...
>
> Unless I am missing something:
Yes you are missing something. I, for example have a few cases where it is useful. On the other hand, I was against the change in the meaning of private but, I have to concede that the new meaning is useful.
As for dropping file private, why? You don’t have to use it if you don’t want to, so it’s not hurting you. On the other hand, I can use it when I deem it to be the right thing to do.
> I don’t want the inner elements
> of a class (or struct ?) to be visible in outer scope!
> This is the default case in most OOP languages.
The default in Java is package scope. I’m not sure what the default in C++ is, but it’s not private, ditto Javascript. So while that might not be most OOP languages, it probably covers most OOP programs.
While I think private by default has merit, we are where we are.
More information about the swift-evolution
mailing list