[swift-evolution] [Review] SE-0025 Scoped Access Level

Nate Cook natecook at gmail.com
Sun Feb 28 13:55:25 CST 2016


> On Feb 28, 2016, at 12:17 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Nate Cook via swift-evolution
> <swift-evolution at swift.org> wrote:
> 
>> For another example, see this comment in the standard library, which says
>> not to use the _variantStorage property, then scroll down about twenty >
>> lines to see it used:
>> 	https://github.com/apple/swift/blob/master/stdlib/public/core/HashedCollections.swift.gyb#L432
>> 
>> As a reader of this file, what should be my interpretation here? (a) The
>> init that uses _variantStorage just got put in the wrong place, (b) the
>> init should've been written without using _variantStorage, or (c) the
>> comment is outdated? Marking _variantStorage as scoped and closing the
>> initial declaration block of the type would both communicate and enforce the actual intent.
> 
> The standard library can't take advantage of private access control yet
> because of the way its implementation is fully serialized and exposed to
> every program. It's not a great example of how access control ought to be
> used. 

Understood! And I should clarify that I'm not proposing a change or pointing out a defect within the standard library, just that it jumped out as an example of the limitations of using documentation to enforce limited access.

Nate



More information about the swift-evolution mailing list