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

Paul Ossenbruggen possen at gmail.com
Thu Mar 31 09:45:29 CDT 2016


Yep good point Ross. Should have double checked that.(I think it is because kids in school kept saying intermural instead of intramural You would think the latin I took would have broken me of that. :-). 

I think all of the proposals below are clear and I like any of them except 3, too long. The parenthesized ones are if we want consistency between the middle two scopes.  

So, proposal one (and 1b), more technical sounding

public
internal (or intramodule)
intrafile
private

Proposal two infile (and 2b). Shortest, eye pleasing, non technical sounding 

public
internal (or inmodule) 
infile
private

Proposal three: (and 3b) longest names, multiword. reusing private, unpleasing compound words.. 

public 
internal (or moduleprivate)
fileprivate
private

proposal four: (and 4b):kind of needs the 4b form, to show pattern (I think)

private
internal (modulewide)
filewide
private

proposal five (and 5b) short eye pleasing. 

private
internal (moduleonly)
fileonly
private


> On Mar 31, 2016, at 2:10 AM, Ross O'Brien <narrativium+swift at gmail.com> wrote:
> 
> > public
> > internal
> > interfile
> > private
> 
> Linguistically, I really like this direction. 'interfile' is one word, it reads as an adjective, it can be used in conversation (this has interfile visibility), and it's clear about where its visibility ends.
> 
> It just doesn't mean what you think it means.
> 
> 'inter' means 'between'. See: 'intergalactic', 'interstellar', 'international', 'internet'. So 'interfile' would have to mean 'visible between files' - i.e. an interfile symbol in one file is visible in another file. The prefix you're looking for, meaning 'internal', is 'intra' (see: 'intravenous', 'intranet').
> 
> So the scale would become:
> 
> public / intermodule
> internal / intramodule / interfile
> intrafile
> private
> 
> 
> On Thu, Mar 31, 2016 at 6:04 AM, Paul Ossenbruggen via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> public
> internal
> interfile
> private
> 
> still googleable and very clear its scope and meaning, nice latin root. Doesn’t overload “private”, slightly shorter.
> 
> 
> > On Mar 30, 2016, at 9:46 PM, Thorsten Seitz via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> >
> > Looks good to me.
> >
> > -Thorsten
> >
> >> Am 31.03.2016 um 06:22 schrieb Chris Lattner via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:
> >>
> >>> On Mar 23, 2016, at 10:13 PM, Chris Lattner <clattner at apple.com <mailto:clattner at apple.com>> wrote:
> >>> How about we continue this trend, and follow other existing Swift keywords that merge two lowercase words (associatedtype, typealias, etc), and use:
> >>>
> >>>   public
> >>>   moduleprivate
> >>>   fileprivate
> >>>   private
> >>>
> >>> The advantages, as I see them are:
> >>> 1) We keep public and private meaning the “right” and “obvious” things.
> >>> 2) The declmodifiers “read” correctly.
> >>> 3) The unusual ones (moduleprivate and fileprivate) don’t use the awkward parenthesized keyword approach.
> >>> 4) The unusual ones would be “googable”.
> >>> 5) Support for named submodules could be “dropped in” by putting the submodule name/path in parens: private(foo.bar.baz) or moduleprivate(foo.bar).  Putting an identifier in the parens is much more natural than putting keywords in parens.
> >>
> >> I’ve seen a number of concerns on this list about moduleprivate, and how it penalizes folks who want to explicitly write their access control.  I’ve come to think that there is yes-another possible path forward here (which I haven’t seen mentioned so far):
> >>
> >> public
> >> internal
> >> fileprivate
> >> private
> >>
> >> The advantages, as I see them are:
> >> 1) We keep public and private meaning the “right” and “obvious” things.
> >> 2) The declmodifiers “read” correctly.
> >> 3) Compared to Swift 2, there is almost no change.  The only thing that changes is that some uses of Swift 2 “private” will be migrated to “fileprivate”, which makes the intent of the code much more clear.
> >> 4) fileprivate is the unusual and not-really-precedented-in-other-languages modifier, and it would still be “googable”.
> >> 5) The addresses the “excessively long” declmodifier problem that several people are concerned with.
> >> 6) Support for named submodules could be “dropped in” by parameterizing “internal”.
> >>
> >> Thoughts?
> >>
> >> -Chris
> >> _______________________________________________
> >> 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 <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 <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160331/144a388a/attachment.html>


More information about the swift-evolution mailing list