[swift-evolution] SE-0025: Scoped Access Level, next steps
Erica Sadun
erica at ericasadun.com
Tue Mar 15 16:33:19 CDT 2016
> On Mar 15, 2016, at 3:09 PM, Shawn Erickson <shawnce at gmail.com> wrote:
>
>
>
> On Tue, Mar 15, 2016 at 2:05 PM Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
> I see two results on the gmane search and neither one seems to match what you're talking about:
> http://search.gmane.org/?query=Scoped&author=Shawn&group=gmane.comp.lang.swift.evolution&sort=relevance <http://search.gmane.org/?query=Scoped&author=Shawn&group=gmane.comp.lang.swift.evolution&sort=relevance>
>
> Do you have a direct link to the message I should be reading?
>
> Thanks!
>
> [swift-evolution] SE-0025: Scoped Access Level, next steps <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160314/012640.html>
The state of the art is:
public private(set) var foo = 0
If I'm reading and understanding this correctly, you propose a generally postfix solution like this:
public var foo = 0 { // marks default getter and setter public however...
private set // marks default setter private
}
Unless there's a specific getter or setter implementation, I'm not fond of the
postfix declarations. In my opinion `private set` is modifying `public`, not `var foo = 0`
I recognize that in a type rather than a global variable, the modification
override could not be adjacent. Another comparison. Current art:
public struct bar {
private(set) var gar = 0
}
vs (what I think is) your suggestion:
public struct bar {
var gar = 0 {
private set
}
}
And again, moving the access control modification to the end just doesn't look
right to me or seem to enhance readability. :(
-- E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160315/8746b2ef/attachment.html>
More information about the swift-evolution
mailing list