[swift-evolution] SE-0025: Scoped Access Level, next steps

Erica Sadun erica at ericasadun.com
Thu Mar 24 18:20:51 CDT 2016

> On Mar 24, 2016, at 5:13 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
>> I think it does. `module` could mean many things related to how Swift creates and consumes modules. 
>> `moduleprivate` combines something about access levels (public/private) and scope (module), is easy to 
>> Google, offers few "wrong" interpretations. By using a longer keyword, it is less flexible in meaning and 
>> more fixed in purpose.
> Sure, but is that worth 7 to 9 extra characters at every single use site for something that's actually pretty common? Is it worth the muddled mess of an all-lowercase keyword with no obvious break, or the attention-grabbing of a capital letter or an underscore?
> `module` and `file` are not going to be obscure corners of the language. Most people will probably learn about them at the same time they learn about `public` and `private`. 
> (Actually, if `module` continues to be the default, you probably won't see it *that* often. You *will* see `file`, but that's the one that can't be as easily confused with a declaration.)
> Obviousness for new users is great, but you can take it too far. We call the type `Int32`, not `SignedIntegerBetweenNegative2ToThe31stPowerAnd2ToThe31stPowerMinus1`—and if we did, it's not clear the longer name would really be more obvious, because it would be such a pain to read.

`moduleprivate` is the default value. I doubt it will get  used much if at all. I don't think `fileprivate` will get used much either
but in such cases, I think those seven extra letters are essential and documenting.

The two remaining public and private access levels are simple and intuitively obvious.

-- E

More information about the swift-evolution mailing list