[Rejected] SE-0159: Fix Private Access Levels


(Douglas Gregor) #1

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md

The review of ran from March 20...27, 2017. The proposal has been *rejected*.

The core team had a lengthy discussion of this proposal as well as related ideas that came up during (and prior to) the review [*].

SE-0159 <https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md> specifically sought to revert the main user-facing part of SE-0025 <https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md>, which gave “private” lexical-scoping semantics and introduced “fileprivate”. The core team felt that there was sufficient evidence that more-restrictive-than-fileprivate access control is in use within the Swift community and in established patterns, such that it would be harmful to remove the functionality introduced by SE-0025 <https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md> at this point.

The core team discussed the idea of renaming to keywords that was brought up in the thread as a way to address many of the concerns raised in SE-0159 <https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md> while providing the same language semantics. Specifically:

  * “private” -> “scoped”
  * “fileprivate” -> “private”

The core team determined that such a change, while (technically) easy to automatically migrate, would introduce far too much churn in Swift code bases moving from Swift 3 to Swift 4, compromising the source stability goals set out for Swift 4.

Finally, the core team discussed a different potential design for “private” that admits a limited form of type-based access control within files. We will open a separate discussion thread on Swift Evolution, with the subject "Type-based ‘private’ access within a file", and are seeking further discussion there and a motivated volunteer to turn it into a new proposal for Swift 4.

- Doug Gregor
Review Manager

[*] Big thanks to Alex Martini for his excellent notes.


#2

I am greatly disappointed by this decision. The existence of the keyword
“fileprivate” is an unfortunate blemish which never should have been
brought into existence. In my view, the churn caused by renaming “private”
last year was a major mistake, and we should correct it immediately.

I hope the core team will reconsider the spelling change to “private” and
“scoped”.

Nevin

···

On Mon, Apr 3, 2017 at 2:34 PM, Douglas Gregor via swift-evolution < swift-evolution@swift.org> wrote:

Proposal Link: https://github.com/apple/swift-evolution/blob/
master/proposals/0159-fix-private-access-levels.md

The review of ran from March 20...27, 2017. The proposal has been
*rejected*.

The core team had a lengthy discussion of this proposal as well as related
ideas that came up during (and prior to) the review [*].

SE-0159
<https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md> specifically
sought to revert the main user-facing part of SE-0025
<https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md>,
which gave “private” lexical-scoping semantics and introduced
“fileprivate”. The core team felt that there was sufficient evidence that
more-restrictive-than-fileprivate access control is in use within the
Swift community and in established patterns, such that it would be harmful
to remove the functionality introduced by SE-0025
<https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md> at
this point.

The core team discussed the idea of renaming to keywords that was brought
up in the thread as a way to address many of the concerns raised in
SE-0159
<https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md> while
providing the same language semantics. Specifically:

* “private” -> “scoped”
* “fileprivate” -> “private”

The core team determined that such a change, while (technically) easy to
automatically migrate, would introduce far too much churn in Swift code
bases moving from Swift 3 to Swift 4, compromising the source stability
goals set out for Swift 4.

Finally, the core team discussed a different potential design for
“private” that admits a limited form of type-based access control within
files. We will open a separate discussion thread on Swift Evolution, with
the subject "Type-based ‘private’ access within a file", and are seeking
further discussion there and a motivated volunteer to turn it into a new
proposal for Swift 4.

- Doug Gregor
Review Manager

[*] Big thanks to Alex Martini for his excellent notes.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(John McCall) #3

I am greatly disappointed by this decision. The existence of the keyword “fileprivate” is an unfortunate blemish which never should have been brought into existence. In my view, the churn caused by renaming “private” last year was a major mistake, and we should correct it immediately.

I agree that we shouldn't have done it, but:

I hope the core team will reconsider the spelling change to “private” and “scoped”.

We won't.

John.

···

On Apr 3, 2017, at 3:50 PM, Nevin Brackett-Rozinsky via swift-evolution <swift-evolution@swift.org> wrote:

Nevin

On Mon, Apr 3, 2017 at 2:34 PM, Douglas Gregor via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md

The review of ran from March 20...27, 2017. The proposal has been *rejected*.

The core team had a lengthy discussion of this proposal as well as related ideas that came up during (and prior to) the review [*].

SE-0159 <https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md> specifically sought to revert the main user-facing part of SE-0025 <https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md>, which gave “private” lexical-scoping semantics and introduced “fileprivate”. The core team felt that there was sufficient evidence that more-restrictive-than-fileprivate access control is in use within the Swift community and in established patterns, such that it would be harmful to remove the functionality introduced by SE-0025 <https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md> at this point.

The core team discussed the idea of renaming to keywords that was brought up in the thread as a way to address many of the concerns raised in SE-0159 <https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md> while providing the same language semantics. Specifically:

  * “private” -> “scoped”
  * “fileprivate” -> “private”

The core team determined that such a change, while (technically) easy to automatically migrate, would introduce far too much churn in Swift code bases moving from Swift 3 to Swift 4, compromising the source stability goals set out for Swift 4.

Finally, the core team discussed a different potential design for “private” that admits a limited form of type-based access control within files. We will open a separate discussion thread on Swift Evolution, with the subject "Type-based ‘private’ access within a file", and are seeking further discussion there and a motivated volunteer to turn it into a new proposal for Swift 4.

- Doug Gregor
Review Manager

[*] Big thanks to Alex Martini for his excellent notes.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution


(Michel Fortin) #4

I find that unfortunate, but it's good to be fixed.

I recently replaced every instance of `private` by `fileprivate` in my code. This discussion made me realize that the intended unit of encapsulation for me when I write `private` is almost always the file. The code should reflect that intent regardless of whether the compiler would allow a narrower access level to be used.

I will reserve `private` for special occasions when tighter encapsulation is needed. Doing it that way, `private` will actually have some meaning when I use it. Current use is zero though, and that's fine by me.

As for introducing type-based private, it'd probably make using `private` for special occasions less interesting because the additional protection over `fileprivate` are negligible.

···

Le 3 avr. 2017 à 16:20, John McCall via swift-evolution <swift-evolution@swift.org> a écrit :

I hope the core team will reconsider the spelling change to “private” and “scoped”.

We won't.

--
Michel Fortin
https://michelf.ca