[swift-evolution] Type-based ‘private’ access within a file

Nevin Brackett-Rozinsky nevin.brackettrozinsky at gmail.com
Mon Apr 3 20:11:40 CDT 2017

On Mon, Apr 3, 2017 at 8:26 PM, Jarod Long via swift-evolution <
swift-evolution at swift.org> wrote:

> Pretty bummed out about the rejection. I know it's a petty aesthetic
> issue, but thinking about having to write "fileprivate" 5 or 10 years from
> now kills more of my enthusiasm about using the language than I'd like to
> admit. I think it's going to always be viewed by most as a major wart on an
> otherwise great language.

I agree. If someone made a fork of Swift whose only difference was to
change the spellings to “private” and “scoped”, and there was a way to use
it with Xcode, then I would use that instead of the official version in a
heartbeat. Heck, if someone made a preprocessor that just replaced the
access modifiers before compiling, I’d jump at the chance to use it.

My remaining hope is that Swift will acquire a submodule design which
renders “fileprivate” essentially redundant. If we get an access level that
means “visible in a group of tightly-related files” and it has a concise
spelling, then I will use that just about exclusively. If a file is not
explicitly part of a submodule then that new level would be synonymous with
“fileprivate”, and if it is in a submodule then that level is exactly what
I want anyway, so I can split up tightly-coupled implementations into
separate files.

I don’t know what the spelling for that access level would be, but if we
can find a good one then I’ll be happy to never have to type “fileprivate”

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170403/136f2954/attachment.html>

More information about the swift-evolution mailing list